Update Rust toolchain to 1.89 (#19807)

This commit is contained in:
Micha Reiser 2025-08-07 18:21:50 +02:00 committed by GitHub
parent b22586fa0e
commit 7dfde3b929
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
101 changed files with 234 additions and 200 deletions

View file

@ -21,7 +21,7 @@ where
}
/// Formats the passed comments as leading comments
pub(crate) const fn leading_comments(comments: &[SourceComment]) -> FormatLeadingComments {
pub(crate) const fn leading_comments(comments: &[SourceComment]) -> FormatLeadingComments<'_> {
FormatLeadingComments::Comments(comments)
}
@ -135,7 +135,7 @@ impl Format<PyFormatContext<'_>> for FormatLeadingAlternateBranchComments<'_> {
}
/// Formats the passed comments as trailing comments
pub(crate) fn trailing_comments(comments: &[SourceComment]) -> FormatTrailingComments {
pub(crate) fn trailing_comments(comments: &[SourceComment]) -> FormatTrailingComments<'_> {
FormatTrailingComments(comments)
}
@ -199,7 +199,7 @@ where
FormatDanglingComments::Node(node.into())
}
pub(crate) fn dangling_comments(comments: &[SourceComment]) -> FormatDanglingComments {
pub(crate) fn dangling_comments(comments: &[SourceComment]) -> FormatDanglingComments<'_> {
FormatDanglingComments::Comments(comments)
}
@ -260,7 +260,7 @@ impl Format<PyFormatContext<'_>> for FormatDanglingComments<'_> {
/// ```
pub(crate) fn dangling_open_parenthesis_comments(
comments: &[SourceComment],
) -> FormatDanglingOpenParenthesisComments {
) -> FormatDanglingOpenParenthesisComments<'_> {
FormatDanglingOpenParenthesisComments { comments }
}
@ -292,7 +292,7 @@ impl Format<PyFormatContext<'_>> for FormatDanglingOpenParenthesisComments<'_> {
///
/// * Adds a whitespace between `#` and the comment text except if the first character is a `#`, `:`, `'`, or `!`
/// * Replaces non breaking whitespaces with regular whitespaces except if in front of a `types:` comment
pub(crate) const fn format_comment(comment: &SourceComment) -> FormatComment {
pub(crate) const fn format_comment(comment: &SourceComment) -> FormatComment<'_> {
FormatComment { comment }
}
@ -361,7 +361,7 @@ impl Format<PyFormatContext<'_>> for FormatEmptyLines {
/// * Expands parent node.
pub(crate) const fn trailing_end_of_line_comment(
comment: &SourceComment,
) -> FormatTrailingEndOfLineComment {
) -> FormatTrailingEndOfLineComment<'_> {
FormatTrailingEndOfLineComment { comment }
}
@ -537,7 +537,7 @@ fn strip_comment_prefix(comment_text: &str) -> FormatResult<&str> {
pub(crate) fn empty_lines_before_trailing_comments(
comments: &[SourceComment],
node_kind: NodeKind,
) -> FormatEmptyLinesBeforeTrailingComments {
) -> FormatEmptyLinesBeforeTrailingComments<'_> {
FormatEmptyLinesBeforeTrailingComments {
comments,
node_kind,
@ -589,7 +589,7 @@ impl Format<PyFormatContext<'_>> for FormatEmptyLinesBeforeTrailingComments<'_>
/// additional empty line before the comment.
pub(crate) fn empty_lines_after_leading_comments(
comments: &[SourceComment],
) -> FormatEmptyLinesAfterLeadingComments {
) -> FormatEmptyLinesAfterLeadingComments<'_> {
FormatEmptyLinesAfterLeadingComments { comments }
}

View file

@ -249,7 +249,7 @@ impl<K: std::hash::Hash + Eq, V> MultiMap<K, V> {
}
/// Returns the *leading*, *dangling*, and *trailing* parts of `key`.
pub(super) fn leading_dangling_trailing(&self, key: &K) -> LeadingDanglingTrailing<V> {
pub(super) fn leading_dangling_trailing(&self, key: &K) -> LeadingDanglingTrailing<'_, V> {
match self.index.get(key) {
None => LeadingDanglingTrailing {
leading: &[],

View file

@ -358,7 +358,10 @@ impl<'a> Comments<'a> {
}
/// Returns an iterator over the [leading](self#leading-comments), [dangling](self#dangling-comments), and [trailing](self#trailing) comments of `node`.
pub(crate) fn leading_dangling_trailing<T>(&self, node: T) -> LeadingDanglingTrailingComments
pub(crate) fn leading_dangling_trailing<T>(
&self,
node: T,
) -> LeadingDanglingTrailingComments<'_>
where
T: Into<AnyNodeRef<'a>>,
{
@ -540,7 +543,7 @@ mod tests {
}
}
fn to_comments(&self) -> Comments {
fn to_comments(&self) -> Comments<'_> {
Comments::from_ast(self.parsed.syntax(), self.source_code, &self.comment_ranges)
}
}

View file

@ -18,7 +18,7 @@ impl<'a> NodeRefEqualityKey<'a> {
}
/// Returns the underlying node.
pub(super) fn node(&self) -> AnyNodeRef {
pub(super) fn node(&self) -> AnyNodeRef<'_> {
self.node
}
}

View file

@ -121,7 +121,7 @@ impl FormatContext for PyFormatContext<'_> {
&self.options
}
fn source_code(&self) -> SourceCode {
fn source_code(&self) -> SourceCode<'_> {
SourceCode::new(self.contents)
}
}

View file

@ -62,7 +62,7 @@ impl NeedsParentheses for ExprNumberLiteral {
}
/// Returns the normalized integer string.
fn normalize_integer(input: &str) -> Cow<str> {
fn normalize_integer(input: &str) -> Cow<'_, str> {
// The normalized string if `input` is not yet normalized.
// `output` must remain empty if `input` is already normalized.
let mut output = String::new();
@ -107,7 +107,7 @@ fn normalize_integer(input: &str) -> Cow<str> {
}
/// Returns the normalized floating number string.
fn normalize_floating_number(input: &str) -> Cow<str> {
fn normalize_floating_number(input: &str) -> Cow<'_, str> {
// The normalized string if `input` is not yet normalized.
// `output` must remain empty if `input` is already normalized.
let mut output = String::new();

View file

@ -645,7 +645,7 @@ pub(crate) fn normalize_string(
start_offset: usize,
new_flags: AnyStringFlags,
escape_braces: bool,
) -> Cow<str> {
) -> Cow<'_, str> {
// The normalized string if `input` is not yet normalized.
// `output` must remain empty if `input` is already normalized.
let mut output = String::new();
@ -798,7 +798,7 @@ impl UnicodeEscape {
///
/// * `\u`, `\U'` and `\x`: To use lower case for the characters `a-f`.
/// * `\N`: To use uppercase letters
fn normalize(self, input: &str) -> Option<Cow<str>> {
fn normalize(self, input: &str) -> Option<Cow<'_, str>> {
let mut normalised = String::new();
let len = match self {