diff --git a/Cargo.lock b/Cargo.lock index 90bf169b58..0a0c61e2e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -128,9 +128,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "approx" diff --git a/crates/ruff_linter/src/fix/codemods.rs b/crates/ruff_linter/src/fix/codemods.rs index aca0a8f0c1..3d181dfeb7 100644 --- a/crates/ruff_linter/src/fix/codemods.rs +++ b/crates/ruff_linter/src/fix/codemods.rs @@ -65,7 +65,7 @@ pub(crate) fn remove_imports<'a>( if member == "*" { found_star = true; } else { - bail!("Expected \"*\" for unused import (got: \"{}\")", member); + bail!("Expected \"*\" for unused import (got: \"{member}\")"); } } if !found_star { diff --git a/crates/ruff_python_parser/tests/generate_inline_tests.rs b/crates/ruff_python_parser/tests/generate_inline_tests.rs index 908f7c6337..16da01d5e2 100644 --- a/crates/ruff_python_parser/tests/generate_inline_tests.rs +++ b/crates/ruff_python_parser/tests/generate_inline_tests.rs @@ -30,7 +30,7 @@ fn generate_inline_tests() -> Result<()> { test_files += install_tests(&tests.err, "crates/ruff_python_parser/resources/inline/err")?; if !test_files.is_empty() { - anyhow::bail!("{}", test_files); + anyhow::bail!("{test_files}"); } Ok(()) diff --git a/crates/ruff_server/src/format.rs b/crates/ruff_server/src/format.rs index 44f5466e11..38455514a9 100644 --- a/crates/ruff_server/src/format.rs +++ b/crates/ruff_server/src/format.rs @@ -287,7 +287,7 @@ impl UvFormatCommand { "The installed version of uv does not support `uv format`; upgrade to a newer version" ); } - anyhow::bail!("Failed to format document: {}", stderr); + anyhow::bail!("Failed to format document: {stderr}"); } let formatted = String::from_utf8(result.stdout) diff --git a/crates/ruff_server/src/session/index.rs b/crates/ruff_server/src/session/index.rs index 820f48ccbd..42220ffa9d 100644 --- a/crates/ruff_server/src/session/index.rs +++ b/crates/ruff_server/src/session/index.rs @@ -187,12 +187,9 @@ impl Index { anyhow!("Failed to convert workspace URL to file path: {workspace_url}") })?; - self.settings.remove(&workspace_path).ok_or_else(|| { - anyhow!( - "Tried to remove non-existent workspace URI {}", - workspace_url - ) - })?; + self.settings + .remove(&workspace_path) + .ok_or_else(|| anyhow!("Tried to remove non-existent workspace URI {workspace_url}"))?; // O(n) complexity, which isn't ideal... but this is an uncommon operation. self.documents @@ -330,7 +327,7 @@ impl Index { }; let Some(_) = self.documents.remove(&url) else { - anyhow::bail!("tried to close document that didn't exist at {}", url) + anyhow::bail!("tried to close document that didn't exist at {url}") }; Ok(()) } @@ -351,7 +348,7 @@ impl Index { anyhow::bail!("Tried to open unavailable document `{key}`"); }; let Some(controller) = self.documents.get_mut(&url) else { - anyhow::bail!("Document controller not available at `{}`", url); + anyhow::bail!("Document controller not available at `{url}`"); }; Ok(controller) } diff --git a/crates/ruff_workspace/src/configuration.rs b/crates/ruff_workspace/src/configuration.rs index d916ff0324..7839fe11f6 100644 --- a/crates/ruff_workspace/src/configuration.rs +++ b/crates/ruff_workspace/src/configuration.rs @@ -158,9 +158,7 @@ impl Configuration { .expect("RUFF_PKG_VERSION is not a valid PEP 440 version specifier"); if !required_version.contains(&ruff_pkg_version) { return Err(anyhow!( - "Required version `{}` does not match the running version `{}`", - required_version, - RUFF_PKG_VERSION + "Required version `{required_version}` does not match the running version `{RUFF_PKG_VERSION}`" )); } } diff --git a/crates/ty_server/src/session/index.rs b/crates/ty_server/src/session/index.rs index 624a075198..89d310f2ab 100644 --- a/crates/ty_server/src/session/index.rs +++ b/crates/ty_server/src/session/index.rs @@ -178,7 +178,7 @@ impl Index { let path = key.path(); let Some(_) = self.documents.remove(path) else { - anyhow::bail!("tried to close document that didn't exist at {}", key) + anyhow::bail!("tried to close document that didn't exist at {key}") }; Ok(()) } @@ -189,7 +189,7 @@ impl Index { ) -> crate::Result<&mut DocumentController> { let path = key.path(); let Some(controller) = self.documents.get_mut(path) else { - anyhow::bail!("Document controller not available at `{}`", key); + anyhow::bail!("Document controller not available at `{key}`"); }; Ok(controller) } diff --git a/crates/ty_test/src/parser.rs b/crates/ty_test/src/parser.rs index 68e9ab5198..12ad3b8039 100644 --- a/crates/ty_test/src/parser.rs +++ b/crates/ty_test/src/parser.rs @@ -512,9 +512,8 @@ impl<'s> Parser<'s> { self.process_mdtest_directive(MdtestDirective::PullTypesSkip)?; } else if !HTML_COMMENT_ALLOWLIST.contains(&html_comment) { bail!( - "Unknown HTML comment `{}` -- possibly a typo? \ - (Add to `HTML_COMMENT_ALLOWLIST` if this is a false positive)", - html_comment + "Unknown HTML comment `{html_comment}` -- possibly a typo? \ + (Add to `HTML_COMMENT_ALLOWLIST` if this is a false positive)" ); } self.cursor.skip_bytes(position + HTML_COMMENT_END.len()); @@ -721,8 +720,7 @@ impl<'s> Parser<'s> { } _ => { bail!( - "Cannot auto-generate file name for code block with language `{}` in test `{test_name}`", - lang + "Cannot auto-generate file name for code block with language `{lang}` in test `{test_name}`" ); } },