Skip to content

Commit

Permalink
Merge pull request #619 from rben01/master
Browse files Browse the repository at this point in the history
Fixed some clippy warnings
  • Loading branch information
sharkdp authored Oct 12, 2024
2 parents 1481c73 + 388d6fa commit aaaa69e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
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

0 comments on commit aaaa69e

Please sign in to comment.