mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-17 09:00:26 +00:00
Upgrade Rust toolchain to 1.83 (#14677)
This commit is contained in:
parent
a6402fb51e
commit
b63c2e126b
63 changed files with 127 additions and 127 deletions
|
@ -113,33 +113,29 @@ impl From<&Expr> for ResolvedPythonType {
|
|||
|
||||
// Unary operators.
|
||||
Expr::UnaryOp(ast::ExprUnaryOp { operand, op, .. }) => match op {
|
||||
UnaryOp::Invert => {
|
||||
return match ResolvedPythonType::from(operand.as_ref()) {
|
||||
ResolvedPythonType::Atom(PythonType::Number(
|
||||
NumberLike::Bool | NumberLike::Integer,
|
||||
)) => ResolvedPythonType::Atom(PythonType::Number(NumberLike::Integer)),
|
||||
ResolvedPythonType::Atom(_) => ResolvedPythonType::TypeError,
|
||||
_ => ResolvedPythonType::Unknown,
|
||||
}
|
||||
}
|
||||
UnaryOp::Invert => match ResolvedPythonType::from(operand.as_ref()) {
|
||||
ResolvedPythonType::Atom(PythonType::Number(
|
||||
NumberLike::Bool | NumberLike::Integer,
|
||||
)) => ResolvedPythonType::Atom(PythonType::Number(NumberLike::Integer)),
|
||||
ResolvedPythonType::Atom(_) => ResolvedPythonType::TypeError,
|
||||
_ => ResolvedPythonType::Unknown,
|
||||
},
|
||||
// Ex) `not 1.0`
|
||||
UnaryOp::Not => ResolvedPythonType::Atom(PythonType::Number(NumberLike::Bool)),
|
||||
// Ex) `+1` or `-1`
|
||||
UnaryOp::UAdd | UnaryOp::USub => {
|
||||
return match ResolvedPythonType::from(operand.as_ref()) {
|
||||
ResolvedPythonType::Atom(PythonType::Number(number)) => {
|
||||
ResolvedPythonType::Atom(PythonType::Number(
|
||||
if number == NumberLike::Bool {
|
||||
NumberLike::Integer
|
||||
} else {
|
||||
number
|
||||
},
|
||||
))
|
||||
}
|
||||
ResolvedPythonType::Atom(_) => ResolvedPythonType::TypeError,
|
||||
_ => ResolvedPythonType::Unknown,
|
||||
UnaryOp::UAdd | UnaryOp::USub => match ResolvedPythonType::from(operand.as_ref()) {
|
||||
ResolvedPythonType::Atom(PythonType::Number(number)) => {
|
||||
ResolvedPythonType::Atom(PythonType::Number(
|
||||
if number == NumberLike::Bool {
|
||||
NumberLike::Integer
|
||||
} else {
|
||||
number
|
||||
},
|
||||
))
|
||||
}
|
||||
}
|
||||
ResolvedPythonType::Atom(_) => ResolvedPythonType::TypeError,
|
||||
_ => ResolvedPythonType::Unknown,
|
||||
},
|
||||
},
|
||||
|
||||
// Binary operators.
|
||||
|
|
|
@ -446,7 +446,7 @@ impl<'a> Deref for Bindings<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> DerefMut for Bindings<'a> {
|
||||
impl DerefMut for Bindings<'_> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ pub enum AnyImport<'a, 'ast> {
|
|||
FromImport(&'a FromImport<'ast>),
|
||||
}
|
||||
|
||||
impl<'a, 'ast> Imported<'ast> for AnyImport<'a, 'ast> {
|
||||
impl<'ast> Imported<'ast> for AnyImport<'_, 'ast> {
|
||||
fn qualified_name(&self) -> &QualifiedName<'ast> {
|
||||
match self {
|
||||
Self::Import(import) => import.qualified_name(),
|
||||
|
|
|
@ -209,7 +209,7 @@ impl<'de> serde::de::Deserialize<'de> for NameImports {
|
|||
|
||||
struct AnyNameImportsVisitor;
|
||||
|
||||
impl<'de> serde::de::Visitor<'de> for AnyNameImportsVisitor {
|
||||
impl serde::de::Visitor<'_> for AnyNameImportsVisitor {
|
||||
type Value = NameImports;
|
||||
|
||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Ranged for DunderAllDefinition<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> SemanticModel<'a> {
|
||||
impl SemanticModel<'_> {
|
||||
/// Extract the names bound to a given __all__ assignment.
|
||||
pub fn extract_dunder_all_names<'expr>(
|
||||
&self,
|
||||
|
|
|
@ -255,7 +255,7 @@ impl<'a> Deref for Scopes<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> DerefMut for Scopes<'a> {
|
||||
impl DerefMut for Scopes<'_> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue