Remove some usize references (#3819)
This commit is contained in:
@@ -368,7 +368,7 @@ pub struct ComparableComprehension<'a> {
|
||||
pub target: ComparableExpr<'a>,
|
||||
pub iter: ComparableExpr<'a>,
|
||||
pub ifs: Vec<ComparableExpr<'a>>,
|
||||
pub is_async: &'a usize,
|
||||
pub is_async: usize,
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Comprehension> for ComparableComprehension<'a> {
|
||||
@@ -377,7 +377,7 @@ impl<'a> From<&'a Comprehension> for ComparableComprehension<'a> {
|
||||
target: (&comprehension.target).into(),
|
||||
iter: (&comprehension.iter).into(),
|
||||
ifs: comprehension.ifs.iter().map(Into::into).collect(),
|
||||
is_async: &comprehension.is_async,
|
||||
is_async: comprehension.is_async,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -475,7 +475,7 @@ pub enum ComparableExpr<'a> {
|
||||
},
|
||||
FormattedValue {
|
||||
value: Box<ComparableExpr<'a>>,
|
||||
conversion: &'a usize,
|
||||
conversion: usize,
|
||||
format_spec: Option<Box<ComparableExpr<'a>>>,
|
||||
},
|
||||
JoinedStr {
|
||||
@@ -623,7 +623,7 @@ impl<'a> From<&'a Expr> for ComparableExpr<'a> {
|
||||
format_spec,
|
||||
} => Self::FormattedValue {
|
||||
value: value.into(),
|
||||
conversion,
|
||||
conversion: *conversion,
|
||||
format_spec: format_spec.as_ref().map(Into::into),
|
||||
},
|
||||
ExprKind::JoinedStr { values } => Self::JoinedStr {
|
||||
|
||||
@@ -711,10 +711,10 @@ pub fn uses_magic_variable_access(ctx: &Context, body: &[Stmt]) -> bool {
|
||||
}
|
||||
|
||||
/// Format the module name for a relative import.
|
||||
pub fn format_import_from(level: Option<&usize>, module: Option<&str>) -> String {
|
||||
pub fn format_import_from(level: Option<usize>, module: Option<&str>) -> String {
|
||||
let mut module_name = String::with_capacity(16);
|
||||
if let Some(level) = level {
|
||||
for _ in 0..*level {
|
||||
for _ in 0..level {
|
||||
module_name.push('.');
|
||||
}
|
||||
}
|
||||
@@ -726,18 +726,18 @@ pub fn format_import_from(level: Option<&usize>, module: Option<&str>) -> String
|
||||
|
||||
/// Format the member reference name for a relative import.
|
||||
pub fn format_import_from_member(
|
||||
level: Option<&usize>,
|
||||
level: Option<usize>,
|
||||
module: Option<&str>,
|
||||
member: &str,
|
||||
) -> String {
|
||||
let mut full_name = String::with_capacity(
|
||||
level.map_or(0, |level| *level)
|
||||
level.map_or(0, |level| level)
|
||||
+ module.as_ref().map_or(0, |module| module.len())
|
||||
+ 1
|
||||
+ member.len(),
|
||||
);
|
||||
if let Some(level) = level {
|
||||
for _ in 0..*level {
|
||||
for _ in 0..level {
|
||||
full_name.push('.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user