mirror of https://github.com/astral-sh/ruff
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:
parent
f1aacd0f2c
commit
61bb2a8245
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}`"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}`"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue