1
1
mirror of https://github.com/oxalica/nil.git synced 2024-10-27 04:19:40 +03:00

Apply clippy::uninlined_format_args

This commit is contained in:
oxalica 2023-03-10 15:59:30 +08:00
parent 4ec9367726
commit bbca41c5ee
7 changed files with 11 additions and 10 deletions

View File

@ -61,7 +61,7 @@ baz/../../bar.nix + ../default.nix
for (src, refs) in asserts {
let got = &*db.module_references(f[src]);
let expect = refs.iter().map(|path| f[*path]).collect::<HashSet<_>>();
assert_eq!(got, &expect, "Module {:?} should reference {:?}", src, refs);
assert_eq!(got, &expect, "Module {src:?} should reference {refs:?}");
}
}

View File

@ -78,7 +78,7 @@ pub(crate) fn rename(
// `new = old;`.
edits.push(TextEdit {
delete: TextRange::empty(i.syntax().text_range().end()),
insert: format!("{} = {};", new_attr, old_attr).into(),
insert: format!("{new_attr} = {old_attr};").into(),
});
}
Some(from_expr) => {
@ -142,7 +142,7 @@ pub(crate) fn rename(
// Then construct a new binding.
edits.push(TextEdit {
delete: TextRange::empty(i.syntax().text_range().end()),
insert: format!("{} = {};", old_attr, new_attr).into(),
insert: format!("{old_attr} = {new_attr};").into(),
});
}
@ -227,7 +227,7 @@ mod tests {
if is_same {
src
} else {
format!("{}\n{}\n", src, text)
format!("{src}\n{text}\n")
}
}
Err(err) => err,

View File

@ -171,7 +171,7 @@ impl Fixture {
.into_iter()
.take(marker_len)
.enumerate()
.map(|(i, p)| p.with_context(|| format!("Discontinuous marker: {}", i)))
.map(|(i, p)| p.with_context(|| format!("Discontinuous marker: {i}")))
.collect::<Result<Vec<_>>>()?;
Ok(this)

View File

@ -67,8 +67,7 @@ fn main() {
match nil::main_loop(conn).and_then(|()| io_threads.join().map_err(Into::into)) {
Ok(()) => {}
Err(err) => {
tracing::error!("Unexpected error: {}", err);
eprintln!("{}", err);
tracing::error!("Unexpected error: {err:#}");
process::exit(101);
}
}

View File

@ -51,7 +51,7 @@ impl fmt::Display for ErrorKind {
Self::NestTooDeep => "Nest too deep",
Self::MultipleRoots => "Multiple top-level expressions are not allowed",
Self::MultipleNoAssoc => "No-associative operators cannot be chained",
Self::ExpectToken(tok) => return write!(f, "Expecting {}", tok),
Self::ExpectToken(tok) => return write!(f, "Expecting {tok}"),
Self::ExpectExpr => "Expecting an expression",
Self::ExpectElemExpr => "Expecting a list element expression. Forget parentheses?",
Self::ExpectAttr => {

View File

@ -41,7 +41,7 @@ fn run_test(dir: &Path, ok: bool) {
write!(got, "{:#?}", ast.syntax_node()).unwrap();
if ok != ast.errors().is_empty() {
println!("--------\n{}\n--------", got);
println!("--------\n{got}\n--------");
panic!("Unexpected test result for {}", path.display());
}

View File

@ -53,11 +53,13 @@
"-D" "warnings"
"-D" "clippy::dbg_macro"
"-D" "clippy::todo"
"-D" "clippy::doc_markdown"
"-D" "clippy::manual-let-else"
"-D" "clippy::missing-panics-doc"
"-D" "clippy::semicolon_if_nothing_returned"
"-D" "clippy::todo"
"-D" "clippy::uninlined_format_args"
];
pre-commit = pkgs.writeShellScriptBin "pre-commit" ''