mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:24:57 +00:00
Update Rust toolchain to 1.89 (#19807)
This commit is contained in:
parent
b22586fa0e
commit
7dfde3b929
101 changed files with 234 additions and 200 deletions
|
@ -1900,7 +1900,7 @@ impl<'a> From<&'a Expr> for HashableExpr<'a> {
|
|||
fn from(expr: &'a Expr) -> Self {
|
||||
/// Returns a version of the given expression that can be hashed and compared according to
|
||||
/// Python semantics.
|
||||
fn as_hashable(expr: &Expr) -> ComparableExpr {
|
||||
fn as_hashable(expr: &Expr) -> ComparableExpr<'_> {
|
||||
match expr {
|
||||
Expr::Named(named) => ComparableExpr::NamedExpr(ExprNamed {
|
||||
target: Box::new(ComparableExpr::from(&named.target)),
|
||||
|
|
|
@ -789,7 +789,7 @@ where
|
|||
/// assert_eq!(format_import_from(1, None), ".".to_string());
|
||||
/// assert_eq!(format_import_from(1, Some("foo")), ".foo".to_string());
|
||||
/// ```
|
||||
pub fn format_import_from(level: u32, module: Option<&str>) -> Cow<str> {
|
||||
pub fn format_import_from(level: u32, module: Option<&str>) -> Cow<'_, str> {
|
||||
match (level, module) {
|
||||
(0, Some(module)) => Cow::Borrowed(module),
|
||||
(level, module) => {
|
||||
|
@ -1509,7 +1509,7 @@ pub fn pep_604_union(elts: &[Expr]) -> Expr {
|
|||
[rest @ .., elt] => Expr::BinOp(ast::ExprBinOp {
|
||||
left: Box::new(pep_604_union(rest)),
|
||||
op: Operator::BitOr,
|
||||
right: Box::new(pep_604_union(&[elt.clone()])),
|
||||
right: Box::new(pep_604_union(std::slice::from_ref(elt))),
|
||||
range: TextRange::default(),
|
||||
node_index: AtomicNodeIndex::dummy(),
|
||||
}),
|
||||
|
|
|
@ -162,13 +162,13 @@ impl Ranged for DictItem {
|
|||
impl ExprDict {
|
||||
/// Returns an `Iterator` over the AST nodes representing the
|
||||
/// dictionary's keys.
|
||||
pub fn iter_keys(&self) -> DictKeyIterator {
|
||||
pub fn iter_keys(&self) -> DictKeyIterator<'_> {
|
||||
DictKeyIterator::new(&self.items)
|
||||
}
|
||||
|
||||
/// Returns an `Iterator` over the AST nodes representing the
|
||||
/// dictionary's values.
|
||||
pub fn iter_values(&self) -> DictValueIterator {
|
||||
pub fn iter_values(&self) -> DictValueIterator<'_> {
|
||||
DictValueIterator::new(&self.items)
|
||||
}
|
||||
|
||||
|
@ -462,13 +462,13 @@ impl FStringValue {
|
|||
}
|
||||
|
||||
/// Returns an iterator over all the [`FStringPart`]s contained in this value.
|
||||
pub fn iter(&self) -> Iter<FStringPart> {
|
||||
pub fn iter(&self) -> Iter<'_, FStringPart> {
|
||||
self.as_slice().iter()
|
||||
}
|
||||
|
||||
/// Returns an iterator over all the [`FStringPart`]s contained in this value
|
||||
/// that allows modification.
|
||||
pub fn iter_mut(&mut self) -> IterMut<FStringPart> {
|
||||
pub fn iter_mut(&mut self) -> IterMut<'_, FStringPart> {
|
||||
self.as_mut_slice().iter_mut()
|
||||
}
|
||||
|
||||
|
@ -657,13 +657,13 @@ impl TStringValue {
|
|||
}
|
||||
|
||||
/// Returns an iterator over all the [`TString`]s contained in this value.
|
||||
pub fn iter(&self) -> Iter<TString> {
|
||||
pub fn iter(&self) -> Iter<'_, TString> {
|
||||
self.as_slice().iter()
|
||||
}
|
||||
|
||||
/// Returns an iterator over all the [`TString`]s contained in this value
|
||||
/// that allows modification.
|
||||
pub fn iter_mut(&mut self) -> IterMut<TString> {
|
||||
pub fn iter_mut(&mut self) -> IterMut<'_, TString> {
|
||||
self.as_mut_slice().iter_mut()
|
||||
}
|
||||
|
||||
|
@ -765,7 +765,7 @@ pub trait StringFlags: Copy {
|
|||
AnyStringFlags::new(self.prefix(), self.quote_style(), self.triple_quotes())
|
||||
}
|
||||
|
||||
fn display_contents(self, contents: &str) -> DisplayFlags {
|
||||
fn display_contents(self, contents: &str) -> DisplayFlags<'_> {
|
||||
DisplayFlags {
|
||||
flags: self.as_any_string_flags(),
|
||||
contents,
|
||||
|
@ -1289,13 +1289,13 @@ impl StringLiteralValue {
|
|||
}
|
||||
|
||||
/// Returns an iterator over all the [`StringLiteral`] parts contained in this value.
|
||||
pub fn iter(&self) -> Iter<StringLiteral> {
|
||||
pub fn iter(&self) -> Iter<'_, StringLiteral> {
|
||||
self.as_slice().iter()
|
||||
}
|
||||
|
||||
/// Returns an iterator over all the [`StringLiteral`] parts contained in this value
|
||||
/// that allows modification.
|
||||
pub fn iter_mut(&mut self) -> IterMut<StringLiteral> {
|
||||
pub fn iter_mut(&mut self) -> IterMut<'_, StringLiteral> {
|
||||
self.as_mut_slice().iter_mut()
|
||||
}
|
||||
|
||||
|
@ -1717,13 +1717,13 @@ impl BytesLiteralValue {
|
|||
}
|
||||
|
||||
/// Returns an iterator over all the [`BytesLiteral`] parts contained in this value.
|
||||
pub fn iter(&self) -> Iter<BytesLiteral> {
|
||||
pub fn iter(&self) -> Iter<'_, BytesLiteral> {
|
||||
self.as_slice().iter()
|
||||
}
|
||||
|
||||
/// Returns an iterator over all the [`BytesLiteral`] parts contained in this value
|
||||
/// that allows modification.
|
||||
pub fn iter_mut(&mut self) -> IterMut<BytesLiteral> {
|
||||
pub fn iter_mut(&mut self) -> IterMut<'_, BytesLiteral> {
|
||||
self.as_mut_slice().iter_mut()
|
||||
}
|
||||
|
||||
|
@ -3011,7 +3011,7 @@ impl Parameters {
|
|||
}
|
||||
|
||||
/// Returns an iterator over all parameters included in this [`Parameters`] node.
|
||||
pub fn iter(&self) -> ParametersIterator {
|
||||
pub fn iter(&self) -> ParametersIterator<'_> {
|
||||
ParametersIterator::new(self)
|
||||
}
|
||||
|
||||
|
@ -3328,7 +3328,7 @@ impl Arguments {
|
|||
/// Return the argument with the given name or at the given position, or `None` if no such
|
||||
/// argument exists. Used to retrieve arguments that can be provided _either_ as keyword or
|
||||
/// positional arguments.
|
||||
pub fn find_argument(&self, name: &str, position: usize) -> Option<ArgOrKeyword> {
|
||||
pub fn find_argument(&self, name: &str, position: usize) -> Option<ArgOrKeyword<'_>> {
|
||||
self.find_keyword(name)
|
||||
.map(ArgOrKeyword::from)
|
||||
.or_else(|| self.find_positional(position).map(ArgOrKeyword::from))
|
||||
|
|
|
@ -33,7 +33,7 @@ impl Ranged for IfElifBranch<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn if_elif_branches(stmt_if: &StmtIf) -> impl Iterator<Item = IfElifBranch> {
|
||||
pub fn if_elif_branches(stmt_if: &StmtIf) -> impl Iterator<Item = IfElifBranch<'_>> {
|
||||
iter::once(IfElifBranch {
|
||||
kind: BranchKind::If,
|
||||
test: stmt_if.test.as_ref(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue