Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some clippy warnings #619

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions numbat/examples/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use numbat::markup::plain_text_format;
use numbat::module_importer::FileSystemImporter;
use numbat::resolver::CodeSource;
use numbat::Context;
use percent_encoding;
use std::path::Path;

const AUTO_GENERATED_HINT: &str = "<!-- NOTE! This file is auto-generated -->";
Expand Down Expand Up @@ -119,7 +118,7 @@ fn inspect_functions_in_module(ctx: &Context, prelude_ctx: &Context, module: Str
//Assemble the example output
let result_markup = results.to_markup(
statements.last(),
&example_ctx.dimension_registry(),
example_ctx.dimension_registry(),
true,
true,
);
Expand All @@ -132,9 +131,7 @@ fn inspect_functions_in_module(ctx: &Context, prelude_ctx: &Context, module: Str

print!("<pre>");
print!("<div class=\"buttons\">");
print!("<button class=\"fa fa-play play-button\" title=\"{}\" aria-label=\"{}\" onclick=\" window.open('{}')\"\"></button>",
"Run this code",
"Run this code",
print!("<button class=\"fa fa-play play-button\" title=\"Run this code\" aria-label=\"Run this code\" onclick=\" window.open('{}')\"\"></button>",
example_url);
print!("</div>");
print!("<code class=\"language-nbt hljs numbat\">");
Expand Down Expand Up @@ -171,14 +168,14 @@ fn replace_equation_delimiters(text_in: String) -> String {
text_out.push_str(" \\\\)");
}
}
return text_out;
text_out
}

fn prepare_context() -> Context {
let module_path = Path::new(&std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("modules");
let mut importer = FileSystemImporter::default();
importer.add_path(module_path);
return Context::new(importer);
Context::new(importer)
}

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions numbat/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2902,9 +2902,9 @@ mod tests {
&["@name(\"Some function\") @example(\"some_function(2)\", \"Use this function:\") @example(\"let some_var = some_function(0)\") fn some_function(x) = 1"],
Statement::DefineFunction {
function_name_span: Span::dummy(),
function_name: "some_function".into(),
function_name: "some_function",
type_parameters: vec![],
parameters: vec![(Span::dummy(), "x".into(), None)],
parameters: vec![(Span::dummy(), "x", None)],
body: Some(scalar!(1.0)),
local_variables: vec![],
return_type_annotation: None,
Expand Down
Loading