mirror of
https://github.com/nushell/nushell.git
synced 2025-08-25 21:16:22 +02:00
Fix easy clippy lints from latest stable (#16053)
1.88.0 was released today, clippy now lints (machine-applicable) against: - format strings with empty braces that could be inlined - easy win - `manual_abs_diff` - returning of a stored result of the last expression. - this can be somewhat contentious but touched only a few places
This commit is contained in:
committed by
GitHub
parent
372d576846
commit
9da0f41ebb
@@ -2160,12 +2160,10 @@ fn module_needs_reloading(working_set: &StateWorkingSet, module_id: ModuleId) ->
|
||||
return true;
|
||||
}
|
||||
|
||||
let private_submodule_changed = module
|
||||
module
|
||||
.imported_modules
|
||||
.iter()
|
||||
.any(|submodule_id| submodule_need_reloading(working_set, *submodule_id));
|
||||
|
||||
private_submodule_changed
|
||||
.any(|submodule_id| submodule_need_reloading(working_set, *submodule_id))
|
||||
}
|
||||
|
||||
/// Parse a module from a file.
|
||||
@@ -4052,7 +4050,7 @@ pub fn parse_plugin_use(working_set: &mut StateWorkingSet, call: Box<Call>) -> P
|
||||
|
||||
pub fn find_dirs_var(working_set: &StateWorkingSet, var_name: &str) -> Option<VarId> {
|
||||
working_set
|
||||
.find_variable(format!("${}", var_name).as_bytes())
|
||||
.find_variable(format!("${var_name}").as_bytes())
|
||||
.filter(|var_id| working_set.get_variable(*var_id).const_val.is_some())
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,7 @@ pub fn parse_shape_name(
|
||||
span: Span,
|
||||
use_loc: ShapeDescriptorUse,
|
||||
) -> SyntaxShape {
|
||||
let result = match bytes {
|
||||
match bytes {
|
||||
b"any" => SyntaxShape::Any,
|
||||
b"binary" => SyntaxShape::Binary,
|
||||
b"block" => {
|
||||
@@ -106,20 +106,18 @@ pub fn parse_shape_name(
|
||||
}
|
||||
|
||||
if let Some(decl_id) = working_set.find_decl(cmd_name) {
|
||||
return SyntaxShape::CompleterWrapper(Box::new(shape), decl_id);
|
||||
SyntaxShape::CompleterWrapper(Box::new(shape), decl_id)
|
||||
} else {
|
||||
working_set.error(ParseError::UnknownCommand(cmd_span));
|
||||
return shape;
|
||||
shape
|
||||
}
|
||||
} else {
|
||||
//TODO: Handle error case for unknown shapes
|
||||
working_set.error(ParseError::UnknownType(span));
|
||||
return SyntaxShape::Any;
|
||||
SyntaxShape::Any
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_generic_shape(
|
||||
|
@@ -1688,7 +1688,7 @@ pub fn parse_int(working_set: &mut StateWorkingSet, span: Span) -> Expression {
|
||||
Expression::new(working_set, Expr::Int(num), span, Type::Int)
|
||||
} else {
|
||||
working_set.error(ParseError::InvalidLiteral(
|
||||
format!("invalid digits for radix {}", radix),
|
||||
format!("invalid digits for radix {radix}"),
|
||||
"int".into(),
|
||||
span,
|
||||
));
|
||||
@@ -3387,10 +3387,7 @@ pub fn parse_import_pattern(working_set: &mut StateWorkingSet, spans: &[Span]) -
|
||||
"list"
|
||||
};
|
||||
working_set.error(ParseError::WrongImportPattern(
|
||||
format!(
|
||||
"{} member can be only at the end of an import pattern",
|
||||
what
|
||||
),
|
||||
format!("{what} member can be only at the end of an import pattern"),
|
||||
prev_span,
|
||||
));
|
||||
return Expression::new(
|
||||
@@ -6116,7 +6113,7 @@ fn check_record_key_or_value(
|
||||
let colon_position = i + string_value.span.start;
|
||||
ParseError::InvalidLiteral(
|
||||
"colon".to_string(),
|
||||
format!("bare word specifying record {}", position),
|
||||
format!("bare word specifying record {position}"),
|
||||
Span::new(colon_position, colon_position + 1),
|
||||
)
|
||||
})
|
||||
|
Reference in New Issue
Block a user