Update Rust crate anyhow to v1.0.100 (#20499)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
renovate[bot] 2025-09-22 09:51:52 +02:00 committed by GitHub
parent f1aacd0f2c
commit 61bb2a8245
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 16 additions and 23 deletions

4
Cargo.lock generated
View File

@ -128,9 +128,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.99" version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]] [[package]]
name = "approx" name = "approx"

View File

@ -65,7 +65,7 @@ pub(crate) fn remove_imports<'a>(
if member == "*" { if member == "*" {
found_star = true; found_star = true;
} else { } else {
bail!("Expected \"*\" for unused import (got: \"{}\")", member); bail!("Expected \"*\" for unused import (got: \"{member}\")");
} }
} }
if !found_star { if !found_star {

View File

@ -30,7 +30,7 @@ fn generate_inline_tests() -> Result<()> {
test_files += install_tests(&tests.err, "crates/ruff_python_parser/resources/inline/err")?; test_files += install_tests(&tests.err, "crates/ruff_python_parser/resources/inline/err")?;
if !test_files.is_empty() { if !test_files.is_empty() {
anyhow::bail!("{}", test_files); anyhow::bail!("{test_files}");
} }
Ok(()) Ok(())

View File

@ -287,7 +287,7 @@ impl UvFormatCommand {
"The installed version of uv does not support `uv format`; upgrade to a newer version" "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) let formatted = String::from_utf8(result.stdout)

View File

@ -187,12 +187,9 @@ impl Index {
anyhow!("Failed to convert workspace URL to file path: {workspace_url}") anyhow!("Failed to convert workspace URL to file path: {workspace_url}")
})?; })?;
self.settings.remove(&workspace_path).ok_or_else(|| { self.settings
anyhow!( .remove(&workspace_path)
"Tried to remove non-existent workspace URI {}", .ok_or_else(|| anyhow!("Tried to remove non-existent workspace URI {workspace_url}"))?;
workspace_url
)
})?;
// O(n) complexity, which isn't ideal... but this is an uncommon operation. // O(n) complexity, which isn't ideal... but this is an uncommon operation.
self.documents self.documents
@ -330,7 +327,7 @@ impl Index {
}; };
let Some(_) = self.documents.remove(&url) else { 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(()) Ok(())
} }
@ -351,7 +348,7 @@ impl Index {
anyhow::bail!("Tried to open unavailable document `{key}`"); anyhow::bail!("Tried to open unavailable document `{key}`");
}; };
let Some(controller) = self.documents.get_mut(&url) else { 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) Ok(controller)
} }

View File

@ -158,9 +158,7 @@ impl Configuration {
.expect("RUFF_PKG_VERSION is not a valid PEP 440 version specifier"); .expect("RUFF_PKG_VERSION is not a valid PEP 440 version specifier");
if !required_version.contains(&ruff_pkg_version) { if !required_version.contains(&ruff_pkg_version) {
return Err(anyhow!( return Err(anyhow!(
"Required version `{}` does not match the running version `{}`", "Required version `{required_version}` does not match the running version `{RUFF_PKG_VERSION}`"
required_version,
RUFF_PKG_VERSION
)); ));
} }
} }

View File

@ -178,7 +178,7 @@ impl Index {
let path = key.path(); let path = key.path();
let Some(_) = self.documents.remove(path) else { 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(()) Ok(())
} }
@ -189,7 +189,7 @@ impl Index {
) -> crate::Result<&mut DocumentController> { ) -> crate::Result<&mut DocumentController> {
let path = key.path(); let path = key.path();
let Some(controller) = self.documents.get_mut(path) else { 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) Ok(controller)
} }

View File

@ -512,9 +512,8 @@ impl<'s> Parser<'s> {
self.process_mdtest_directive(MdtestDirective::PullTypesSkip)?; self.process_mdtest_directive(MdtestDirective::PullTypesSkip)?;
} else if !HTML_COMMENT_ALLOWLIST.contains(&html_comment) { } else if !HTML_COMMENT_ALLOWLIST.contains(&html_comment) {
bail!( bail!(
"Unknown HTML comment `{}` -- possibly a typo? \ "Unknown HTML comment `{html_comment}` -- possibly a typo? \
(Add to `HTML_COMMENT_ALLOWLIST` if this is a false positive)", (Add to `HTML_COMMENT_ALLOWLIST` if this is a false positive)"
html_comment
); );
} }
self.cursor.skip_bytes(position + HTML_COMMENT_END.len()); self.cursor.skip_bytes(position + HTML_COMMENT_END.len());
@ -721,8 +720,7 @@ impl<'s> Parser<'s> {
} }
_ => { _ => {
bail!( bail!(
"Cannot auto-generate file name for code block with language `{}` in test `{test_name}`", "Cannot auto-generate file name for code block with language `{lang}` in test `{test_name}`"
lang
); );
} }
}, },