mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 15:15:47 +03:00
cargo clippy
This commit is contained in:
parent
f7f94fbdc8
commit
d0a2b8c3ce
@ -73,7 +73,7 @@ impl InputAst {
|
||||
|
||||
/// Serializes the `Input` into a JSON Value.
|
||||
pub fn to_json_value(&self) -> Result<serde_json::Value> {
|
||||
Ok(serde_json::to_value(&self).map_err(|e| AstError::failed_to_convert_ast_to_json_value(&e))?)
|
||||
Ok(serde_json::to_value(self).map_err(|e| AstError::failed_to_convert_ast_to_json_value(&e))?)
|
||||
}
|
||||
|
||||
/// Serializes the input into a JSON file.
|
||||
|
@ -84,7 +84,7 @@ fn hash_content(content: &str) -> String {
|
||||
}
|
||||
|
||||
fn hash_file(path: &str) -> String {
|
||||
let file = fs::read_to_string(&Path::new(path)).unwrap();
|
||||
let file = fs::read_to_string(Path::new(path)).unwrap();
|
||||
hash_content(&file)
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ fn run_test(test: Test, handler: &Handler, err_buf: &BufferEmitter) -> Result<Va
|
||||
let cwd = test.config.get("cwd").map(|val| {
|
||||
let mut cwd = test.path.clone();
|
||||
cwd.pop();
|
||||
cwd.join(&val.as_str().unwrap())
|
||||
cwd.join(val.as_str().unwrap())
|
||||
});
|
||||
|
||||
let mut parsed = handler.extend_if_error(parse_program(handler, &test.content, cwd))?;
|
||||
|
@ -142,7 +142,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
// Case where `access.name` is not a member of the circuit.
|
||||
None => {
|
||||
self.emit_err(TypeCheckerError::invalid_circuit_variable(
|
||||
&access.name,
|
||||
access.name,
|
||||
&circ,
|
||||
access.name.span(),
|
||||
));
|
||||
@ -405,7 +405,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
|
||||
Some(ret)
|
||||
} else {
|
||||
self.emit_err(TypeCheckerError::unknown_sym("function", &ident.name, ident.span()));
|
||||
self.emit_err(TypeCheckerError::unknown_sym("function", ident.name, ident.span()));
|
||||
None
|
||||
}
|
||||
}
|
||||
@ -451,7 +451,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
} else {
|
||||
self.emit_err(TypeCheckerError::unknown_sym(
|
||||
"circuit",
|
||||
&input.name.name,
|
||||
input.name.name,
|
||||
input.name.span(),
|
||||
));
|
||||
None
|
||||
|
@ -305,7 +305,7 @@ impl<'a> TypeChecker<'a> {
|
||||
None => {
|
||||
// Not a core library circuit.
|
||||
self.emit_err(TypeCheckerError::invalid_core_instruction(
|
||||
&ident.name,
|
||||
ident.name,
|
||||
function.name,
|
||||
ident.span(),
|
||||
));
|
||||
|
@ -50,7 +50,7 @@ impl Command for Deploy {
|
||||
.map_err(|err| PackageError::failed_to_set_cwd(build_directory.display(), err))?;
|
||||
|
||||
// Call the `aleo node` command from the Aleo SDK.
|
||||
let command = AleoDeploy::try_parse_from(&[ALEO_CLI_COMMAND]).map_err(CliError::failed_to_parse_aleo_node)?;
|
||||
let command = AleoDeploy::try_parse_from([ALEO_CLI_COMMAND]).map_err(CliError::failed_to_parse_aleo_node)?;
|
||||
let res = command.parse().map_err(CliError::failed_to_execute_aleo_node)?;
|
||||
|
||||
// Log the output of the `aleo node` command.
|
||||
|
@ -51,7 +51,7 @@ impl Command for New {
|
||||
fn apply(self, context: Context, _: Self::Input) -> Result<Self::Output> {
|
||||
// Call the `aleo new` command from the Aleo SDK.
|
||||
let command =
|
||||
AleoNew::try_parse_from(&[ALEO_CLI_COMMAND, &self.name]).map_err(CliError::failed_to_parse_aleo_new)?;
|
||||
AleoNew::try_parse_from([ALEO_CLI_COMMAND, &self.name]).map_err(CliError::failed_to_parse_aleo_new)?;
|
||||
let result = command.parse().map_err(CliError::failed_to_execute_aleo_new)?;
|
||||
|
||||
// todo: modify the readme file to recommend building with `leo build`.
|
||||
|
@ -67,7 +67,7 @@ impl Context {
|
||||
|
||||
// Read the manifest file to string.
|
||||
let manifest_string =
|
||||
std::fs::read_to_string(&manifest.path()).map_err(PackageError::failed_to_open_manifest)?;
|
||||
std::fs::read_to_string(manifest.path()).map_err(PackageError::failed_to_open_manifest)?;
|
||||
|
||||
// Construct the file path.
|
||||
let build_manifest_path = build_path.join(Manifest::<Network>::file_name());
|
||||
|
Loading…
Reference in New Issue
Block a user