mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-07 21:25:08 +00:00
Upgrade Rust toolchain to 1.84.0 (#15408)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
This commit is contained in:
parent
2d82445794
commit
c39ca8fe6d
18 changed files with 36 additions and 45 deletions
|
@ -211,6 +211,9 @@ redundant_clone = "warn"
|
|||
debug_assert_with_mut_call = "warn"
|
||||
unused_peekable = "warn"
|
||||
|
||||
# Diagnostics are not actionable: Enable once https://github.com/rust-lang/rust-clippy/issues/13774 is resolved.
|
||||
large_stack_arrays = "allow"
|
||||
|
||||
[profile.release]
|
||||
# Note that we set these explicitly, and these values
|
||||
# were chosen based on a trade-off between compile times
|
||||
|
|
|
@ -74,7 +74,7 @@ impl Index {
|
|||
DocumentKey::NotebookCell(url)
|
||||
} else if Path::new(url.path())
|
||||
.extension()
|
||||
.map_or(false, |ext| ext.eq_ignore_ascii_case("ipynb"))
|
||||
.is_some_and(|ext| ext.eq_ignore_ascii_case("ipynb"))
|
||||
{
|
||||
DocumentKey::Notebook(url)
|
||||
} else {
|
||||
|
|
|
@ -285,7 +285,7 @@ impl Workspace {
|
|||
open_files.contains(&file)
|
||||
} else if let Some(system_path) = file.path(db).as_system_path() {
|
||||
self.package(db, system_path)
|
||||
.map_or(false, |package| package.contains_file(db, file))
|
||||
.is_some_and(|package| package.contains_file(db, file))
|
||||
} else {
|
||||
file.path(db).is_system_virtual_path()
|
||||
}
|
||||
|
|
|
@ -959,7 +959,7 @@ A `--config` flag must either be a path to a `.toml` configuration file
|
|||
// We want to display the most helpful error to the user as possible.
|
||||
if Path::new(value)
|
||||
.extension()
|
||||
.map_or(false, |ext| ext.eq_ignore_ascii_case("toml"))
|
||||
.is_some_and(|ext| ext.eq_ignore_ascii_case("toml"))
|
||||
{
|
||||
if !value.contains('=') {
|
||||
tip.push_str(&format!(
|
||||
|
|
|
@ -87,13 +87,13 @@ pub trait System: Debug {
|
|||
/// Returns `true` if `path` exists and is a directory.
|
||||
fn is_directory(&self, path: &SystemPath) -> bool {
|
||||
self.path_metadata(path)
|
||||
.map_or(false, |metadata| metadata.file_type.is_directory())
|
||||
.is_ok_and(|metadata| metadata.file_type.is_directory())
|
||||
}
|
||||
|
||||
/// Returns `true` if `path` exists and is a file.
|
||||
fn is_file(&self, path: &SystemPath) -> bool {
|
||||
self.path_metadata(path)
|
||||
.map_or(false, |metadata| metadata.file_type.is_file())
|
||||
.is_ok_and(|metadata| metadata.file_type.is_file())
|
||||
}
|
||||
|
||||
/// Returns the current working directory
|
||||
|
|
|
@ -497,12 +497,7 @@ impl<'a> Printer<'a> {
|
|||
dest: self.state.buffer.text_len(),
|
||||
};
|
||||
|
||||
if self
|
||||
.state
|
||||
.source_markers
|
||||
.last()
|
||||
.map_or(true, |last| last != &marker)
|
||||
{
|
||||
if self.state.source_markers.last() != Some(&marker) {
|
||||
self.state.source_markers.push(marker);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -540,7 +540,7 @@ fn is_docstring_section(
|
|||
// The return value of the function.
|
||||
// """
|
||||
// ```
|
||||
if previous_line.map_or(false, |line| line.trim().is_empty()) {
|
||||
if previous_line.is_some_and(|line| line.trim().is_empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ pub(crate) fn fix_file(
|
|||
diagnostic
|
||||
.fix
|
||||
.as_ref()
|
||||
.map_or(false, |fix| fix.applies(required_applicability))
|
||||
.is_some_and(|fix| fix.applies(required_applicability))
|
||||
})
|
||||
.peekable();
|
||||
|
||||
|
|
|
@ -78,11 +78,7 @@ impl<'a> Directive<'a> {
|
|||
comment_start = text[..comment_start].trim_end().len();
|
||||
|
||||
// The next character has to be the `#` character.
|
||||
if text[..comment_start]
|
||||
.chars()
|
||||
.last()
|
||||
.map_or(true, |c| c != '#')
|
||||
{
|
||||
if !text[..comment_start].ends_with('#') {
|
||||
continue;
|
||||
}
|
||||
comment_start -= '#'.len_utf8();
|
||||
|
|
|
@ -493,7 +493,7 @@ pub(crate) fn f_strings(checker: &mut Checker, call: &ast::ExprCall, summary: &F
|
|||
checker
|
||||
.semantic()
|
||||
.resolve_qualified_name(call.func.as_ref())
|
||||
.map_or(false, |qualified_name| {
|
||||
.is_some_and(|qualified_name| {
|
||||
matches!(
|
||||
qualified_name.segments(),
|
||||
["django", "utils", "translation", "gettext" | "gettext_lazy"]
|
||||
|
|
|
@ -145,7 +145,7 @@ pub(crate) fn super_call_with_parameters(checker: &mut Checker, call: &ast::Expr
|
|||
.resolve_qualified_name(func)
|
||||
.is_some_and(|name| name.segments() == ["dataclasses", "dataclass"])
|
||||
{
|
||||
arguments.find_keyword("slots").map_or(false, |keyword| {
|
||||
arguments.find_keyword("slots").is_some_and(|keyword| {
|
||||
matches!(
|
||||
keyword.value,
|
||||
Expr::BooleanLiteral(ast::ExprBooleanLiteral { value: true, .. })
|
||||
|
|
|
@ -117,7 +117,7 @@ fn in_subscript_index(expr: &ExprSubscript, semantic: &SemanticModel) -> bool {
|
|||
}
|
||||
|
||||
// E.g., `Generic[DType, Unpack[int]]`.
|
||||
if parent.slice.as_tuple_expr().map_or(false, |slice| {
|
||||
if parent.slice.as_tuple_expr().is_some_and(|slice| {
|
||||
slice
|
||||
.elts
|
||||
.iter()
|
||||
|
@ -144,5 +144,5 @@ fn in_vararg(expr: &ExprSubscript, semantic: &SemanticModel) -> bool {
|
|||
.as_ref()
|
||||
.and_then(|vararg| vararg.annotation.as_ref())
|
||||
.and_then(|annotation| annotation.as_subscript_expr())
|
||||
.map_or(false, |annotation| annotation == expr)
|
||||
== Some(expr)
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ pub(crate) fn print_empty_string(checker: &mut Checker, call: &ast::ExprCall) {
|
|||
let empty_separator = call
|
||||
.arguments
|
||||
.find_keyword("sep")
|
||||
.map_or(false, |keyword| is_empty_string(&keyword.value));
|
||||
.is_some_and(|keyword| is_empty_string(&keyword.value));
|
||||
if !empty_separator {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1732,7 +1732,7 @@ impl StringLiteralValue {
|
|||
pub fn is_unicode(&self) -> bool {
|
||||
self.iter()
|
||||
.next()
|
||||
.map_or(false, |part| part.flags.prefix().is_unicode())
|
||||
.is_some_and(|part| part.flags.prefix().is_unicode())
|
||||
}
|
||||
|
||||
/// Returns a slice of all the [`StringLiteral`] parts contained in this value.
|
||||
|
|
|
@ -85,7 +85,7 @@ pub(crate) struct FormatLeadingAlternateBranchComments<'a> {
|
|||
|
||||
impl Format<PyFormatContext<'_>> for FormatLeadingAlternateBranchComments<'_> {
|
||||
fn fmt(&self, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
if self.last_node.map_or(false, |preceding| {
|
||||
if self.last_node.is_some_and(|preceding| {
|
||||
should_insert_blank_line_after_class_in_stub_file(preceding, None, f.context())
|
||||
}) {
|
||||
write!(f, [empty_line(), leading_comments(self.comments)])?;
|
||||
|
|
|
@ -1002,24 +1002,21 @@ impl<'a> SemanticModel<'a> {
|
|||
let value_name = UnqualifiedName::from_expr(value)?;
|
||||
let (_, tail) = value_name.segments().split_first()?;
|
||||
|
||||
let resolved: QualifiedName = if qualified_name
|
||||
.segments()
|
||||
.first()
|
||||
.map_or(false, |segment| *segment == ".")
|
||||
{
|
||||
from_relative_import(
|
||||
self.module.qualified_name()?,
|
||||
qualified_name.segments(),
|
||||
tail,
|
||||
)?
|
||||
} else {
|
||||
qualified_name
|
||||
.segments()
|
||||
.iter()
|
||||
.chain(tail)
|
||||
.copied()
|
||||
.collect()
|
||||
};
|
||||
let resolved: QualifiedName =
|
||||
if qualified_name.segments().first().copied() == Some(".") {
|
||||
from_relative_import(
|
||||
self.module.qualified_name()?,
|
||||
qualified_name.segments(),
|
||||
tail,
|
||||
)?
|
||||
} else {
|
||||
qualified_name
|
||||
.segments()
|
||||
.iter()
|
||||
.chain(tail)
|
||||
.copied()
|
||||
.collect()
|
||||
};
|
||||
Some(resolved)
|
||||
}
|
||||
BindingKind::Builtin => {
|
||||
|
|
|
@ -125,7 +125,7 @@ impl Index {
|
|||
DocumentKey::NotebookCell(url)
|
||||
} else if Path::new(url.path())
|
||||
.extension()
|
||||
.map_or(false, |ext| ext.eq_ignore_ascii_case("ipynb"))
|
||||
.is_some_and(|ext| ext.eq_ignore_ascii_case("ipynb"))
|
||||
{
|
||||
DocumentKey::Notebook(url)
|
||||
} else {
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[toolchain]
|
||||
channel = "1.83"
|
||||
channel = "1.84"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue