Upgrade to Rust 1.86 and bump MSRV to 1.84 (#17171)

<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

I decided to disable the new
[`needless_continue`](https://rust-lang.github.io/rust-clippy/master/index.html#needless_continue)
rule because I often found the explicit `continue` more readable over an
empty block or having to invert the condition of an other branch.


## Test Plan

`cargo test`

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Micha Reiser 2025-04-03 17:59:44 +02:00 committed by GitHub
parent fedd982fd5
commit 8a4158c5f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
135 changed files with 285 additions and 255 deletions

View file

@ -42,7 +42,7 @@ impl<'ast> Format<PyFormatContext<'ast>> for ParenthesizeIfExpands<'_, 'ast> {
soft_block_indent(&Arguments::from(&self.inner)).fmt(f)?;
} else {
Arguments::from(&self.inner).fmt(f)?;
};
}
if_group_breaks(&token(")")).fmt(f)
}))]

View file

@ -273,7 +273,7 @@ fn handle_enclosed_comment<'a>(
.any(|token| token.kind() == SimpleTokenKind::LBracket)
{
return CommentPlacement::Default(comment);
};
}
// If there are no additional tokens between the open parenthesis and the comment, then
// it should be attached as a dangling comment on the brackets, rather than a leading
@ -1393,7 +1393,7 @@ fn handle_attribute_comment<'a>(
{
if comment.start() < right_paren.start() {
return CommentPlacement::trailing(attribute.value.as_ref(), comment);
};
}
}
// If the comment precedes the `.`, treat it as trailing _if_ it's on the same line as the
@ -1648,7 +1648,7 @@ fn handle_pattern_match_mapping_comment<'a>(
// like `rest` above, isn't a node.)
if comment.following_node().is_some() {
return CommentPlacement::Default(comment);
};
}
// If there's no rest pattern, no need to do anything special.
let Some(rest) = pattern.rest.as_ref() else {

View file

@ -363,7 +363,7 @@ pub(super) enum CommentPlacement<'a> {
/// Makes the comment a...
///
/// * [trailing comment] of the [`preceding_node`] if both the [`following_node`] and [`preceding_node`] are not [None]
/// and the comment and [`preceding_node`] are only separated by a space (there's no token between the comment and [`preceding_node`]).
/// and the comment and [`preceding_node`] are only separated by a space (there's no token between the comment and [`preceding_node`]).
/// * [leading comment] of the [`following_node`] if the [`following_node`] is not [None]
/// * [trailing comment] of the [`preceding_node`] if the [`preceding_node`] is not [None]
/// * [dangling comment] of the [`enclosing_node`].

View file

@ -518,8 +518,8 @@ impl<'ast> IntoFormat<PyFormatContext<'ast>> for Expr {
///
/// We prefer parentheses at least in the following cases:
/// * The expression contains more than one unparenthesized expression with the same precedence. For example,
/// the expression `a * b * c` contains two multiply operations. We prefer parentheses in that case.
/// `(a * b) * c` or `a * b + c` are okay, because the subexpression is parenthesized, or the expression uses operands with a lower precedence
/// the expression `a * b * c` contains two multiply operations. We prefer parentheses in that case.
/// `(a * b) * c` or `a * b + c` are okay, because the subexpression is parenthesized, or the expression uses operands with a lower precedence
/// * The expression contains at least one parenthesized sub expression (optimization to avoid unnecessary work)
///
/// This mimics Black's [`_maybe_split_omitting_optional_parens`](https://github.com/psf/black/blob/d1248ca9beaf0ba526d265f4108836d89cf551b7/src/black/linegen.py#L746-L820)
@ -787,7 +787,7 @@ impl<'input> CanOmitOptionalParenthesesVisitor<'input> {
| Expr::IpyEscapeCommand(_) => {
return;
}
};
}
walk_expr(self, expr);
}

View file

@ -459,7 +459,7 @@ impl<'src> DocstringLinePrinter<'_, '_, '_, 'src> {
Indentation::from_str(trim_end).columns() - self.stripped_indentation.columns();
let in_docstring_indent = " ".repeat(indent_len) + trim_end.trim_start();
text(&in_docstring_indent).fmt(self.f)?;
};
}
// We handled the case that the closing quotes are on their own line
// above (the last line is empty except for whitespace). If they are on

View file

@ -679,7 +679,7 @@ pub(crate) fn normalize_string(
output.push_str(&input[last_index..escape_start_offset]);
output.push_str(normalised);
last_index = escape_start_offset + normalised.len();
};
}
// Move the `chars` iterator passed the escape sequence.
// Simply reassigning `chars` doesn't work because the indices` would

View file

@ -478,7 +478,7 @@ enum SuppressionComments<'a> {
/// Any following `fmt: off` comment if any.
/// * `None`: The suppression ends here (for good)
/// * `Some`: A `fmt: off`..`fmt: on` .. `fmt: off` sequence. The suppression continues after
/// the `fmt: off` comment.
/// the `fmt: off` comment.
format_off_comment: Option<&'a SourceComment>,
},