Skip to content

Commit

Permalink
bump MSRV to 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Feb 21, 2025
1 parent d2e034a commit 35822eb
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"

[workspace.package]
edition = "2021"
rust-version = "1.80"
rust-version = "1.83"
homepage = "https://docs.astral.sh/ruff"
documentation = "https://docs.astral.sh/ruff"
repository = "https://github.com/astral-sh/ruff"
Expand Down
4 changes: 2 additions & 2 deletions crates/red_knot_project/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ impl ProjectMetadata {
// If the `options` don't specify a python version but the `project.requires-python` field is set,
// use that as a lower bound instead.
if let Some(project) = project {
if !options
if options
.environment
.as_ref()
.is_some_and(|env| env.python_version.is_some())
.is_none_or(|env| env.python_version.is_none())
{
if let Some(requires_python) = project.resolve_requires_python_lower_bound()? {
let mut environment = options.environment.unwrap_or_default();
Expand Down
8 changes: 4 additions & 4 deletions crates/red_knot_test/src/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,12 @@ impl Matcher {
let position = unmatched.iter().position(|diagnostic| {
!error.rule.is_some_and(|rule| {
!(diagnostic.id().is_lint_named(rule) || diagnostic.id().matches(rule))
}) && !error
}) && error
.column
.is_some_and(|col| col != self.column(*diagnostic))
&& !error
.is_none_or(|col| col == self.column(*diagnostic))
&& error
.message_contains
.is_some_and(|needle| !diagnostic.message().contains(needle))
.is_none_or(|needle| diagnostic.message().contains(needle))
});
if let Some(position) = position {
unmatched.swap_remove(position);
Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_formatter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,13 @@ impl Printed {
for marker in self.sourcemap {
// Take the closest start marker, but skip over start_markers that have the same start.
if marker.source <= source_range.start()
&& !start_marker.is_some_and(|existing| existing.source >= marker.source)
&& start_marker.is_none_or(|existing| existing.source < marker.source)
{
start_marker = Some(marker);
}

if marker.source >= source_range.end()
&& !end_marker.is_some_and(|existing| existing.source <= marker.source)
&& end_marker.is_none_or(|existing| existing.source > marker.source)
{
end_marker = Some(marker);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ pub(crate) fn tarfile_unsafe_members(checker: &Checker, call: &ast::ExprCall) {
return;
}

if !call
if call
.func
.as_attribute_expr()
.is_some_and(|attr| attr.attr.as_str() == "extractall")
.is_none_or(|attr| attr.attr.as_str() != "extractall")
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ pub(crate) fn implicit_namespace_package(
// Ignore non-`.py` files, which don't require an `__init__.py`.
&& PySourceType::try_from_path(path).is_some_and(PySourceType::is_py_file)
// Ignore any files that are direct children of the project root.
&& !path
&& path
.parent()
.is_some_and( |parent| parent == project_root)
.is_none_or( |parent| parent != project_root)
// Ignore any files that are direct children of a source directory (e.g., `src/manage.py`).
&& !path
.parent()
.is_some_and( |parent| src.iter().any(|src| src == parent))
// Ignore files that contain a shebang.
&& !comment_ranges
&& comment_ranges
.first().filter(|range| range.start() == TextSize::from(0))
.is_some_and(|range| ShebangDirective::try_extract(locator.slice(*range)).is_some())
.is_none_or(|range| ShebangDirective::try_extract(locator.slice(*range)).is_none())
// Ignore PEP 723 scripts.
&& ScriptTag::parse(locator.contents().as_bytes()).is_none()
{
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_linter/src/rules/isort/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub(crate) fn normalize_imports<'a>(
&& module.map_or(true, |module| {
!settings.single_line_exclusions.contains(module)
})
&& !names.first().is_some_and(|alias| alias.name == "*");
&& names.first().is_none_or(|alias| alias.name != "*");

// Insert comments on the statement itself.
if isolate_aliases {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub(crate) fn manual_list_copy(checker: &Checker, for_stmt: &ast::StmtFor) {
}

// Only flag direct list copies (e.g., `for x in y: filtered.append(x)`).
if !arg.as_name_expr().is_some_and(|arg| arg.id == *id) {
if arg.as_name_expr().is_none_or(|arg| arg.id != *id) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ pub(crate) fn int_on_sliced_str(checker: &Checker, call: &ExprCall) {
if expr_slice.upper.is_some() || expr_slice.step.is_some() {
return;
}
if !expr_slice
if expr_slice
.lower
.as_ref()
.and_then(|expr| expr.as_number_literal_expr())
.and_then(|expr| expr.value.as_int())
.is_some_and(|expr| expr.as_u8() == Some(2))
.is_none_or(|expr| expr.as_u8() != Some(2))
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn peel_lists(expr: &Expr) -> &Expr {
return expr;
}

if !func.as_name_expr().is_some_and(|name| name.id == "list") {
if func.as_name_expr().is_none_or(|name| name.id != "list") {
return expr;
}

Expand Down Expand Up @@ -175,11 +175,11 @@ fn extract_name_from_sliced_reversed(expr: &Expr) -> Option<&ExprName> {
else {
return None;
};
if !operand
if operand
.as_number_literal_expr()
.and_then(|num| num.value.as_int())
.and_then(Int::as_u8)
.is_some_and(|value| value == 1)
.is_none_or(|value| value != 1)
{
return None;
};
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_python_ast/src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl ScriptTag {
let mut lines = contents.lines();

// Ensure that the first line is exactly `# /// script`.
if !lines.next().is_some_and(|line| line == "# /// script") {
if lines.next().is_none_or(|line| line != "# /// script") {
return None;
}

Expand Down

0 comments on commit 35822eb

Please sign in to comment.