mirror of
https://github.com/nushell/nushell.git
synced 2025-08-12 08:50:05 +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
@ -296,7 +296,7 @@ fn run(
|
||||
} else {
|
||||
let value = stream.into_value();
|
||||
let base_description = value.get_type().to_string();
|
||||
Value::string(format!("{} (stream)", base_description), head)
|
||||
Value::string(format!("{base_description} (stream)"), head)
|
||||
}
|
||||
}
|
||||
PipelineData::Value(value, ..) => {
|
||||
|
@ -229,7 +229,7 @@ fn make_other_error(value: &Value, throw_span: Option<Span>) -> ShellError {
|
||||
error: "invalid error format.".into(),
|
||||
msg: "`$.label.start` should be smaller than `$.label.end`".into(),
|
||||
span: Some(label_span),
|
||||
help: Some(format!("{} > {}", span_start, span_end)),
|
||||
help: Some(format!("{span_start} > {span_end}")),
|
||||
inner: vec![],
|
||||
};
|
||||
}
|
||||
|
@ -221,23 +221,23 @@ impl std::fmt::Debug for DebuggableValue<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self.0 {
|
||||
Value::Bool { val, .. } => {
|
||||
write!(f, "{:?}", val)
|
||||
write!(f, "{val:?}")
|
||||
}
|
||||
Value::Int { val, .. } => {
|
||||
write!(f, "{:?}", val)
|
||||
write!(f, "{val:?}")
|
||||
}
|
||||
Value::Float { val, .. } => {
|
||||
write!(f, "{:?}f", val)
|
||||
write!(f, "{val:?}f")
|
||||
}
|
||||
Value::Filesize { val, .. } => {
|
||||
write!(f, "Filesize({:?})", val)
|
||||
write!(f, "Filesize({val:?})")
|
||||
}
|
||||
Value::Duration { val, .. } => {
|
||||
let duration = std::time::Duration::from_nanos(*val as u64);
|
||||
write!(f, "Duration({:?})", duration)
|
||||
write!(f, "Duration({duration:?})")
|
||||
}
|
||||
Value::Date { val, .. } => {
|
||||
write!(f, "Date({:?})", val)
|
||||
write!(f, "Date({val:?})")
|
||||
}
|
||||
Value::Range { val, .. } => match **val {
|
||||
Range::IntRange(range) => match range.end() {
|
||||
@ -280,7 +280,7 @@ impl std::fmt::Debug for DebuggableValue<'_> {
|
||||
},
|
||||
},
|
||||
Value::String { val, .. } | Value::Glob { val, .. } => {
|
||||
write!(f, "{:?}", val)
|
||||
write!(f, "{val:?}")
|
||||
}
|
||||
Value::Record { val, .. } => {
|
||||
write!(f, "{{")?;
|
||||
@ -305,22 +305,22 @@ impl std::fmt::Debug for DebuggableValue<'_> {
|
||||
write!(f, "]")
|
||||
}
|
||||
Value::Closure { val, .. } => {
|
||||
write!(f, "Closure({:?})", val)
|
||||
write!(f, "Closure({val:?})")
|
||||
}
|
||||
Value::Nothing { .. } => {
|
||||
write!(f, "Nothing")
|
||||
}
|
||||
Value::Error { error, .. } => {
|
||||
write!(f, "Error({:?})", error)
|
||||
write!(f, "Error({error:?})")
|
||||
}
|
||||
Value::Binary { val, .. } => {
|
||||
write!(f, "Binary({:?})", val)
|
||||
write!(f, "Binary({val:?})")
|
||||
}
|
||||
Value::CellPath { val, .. } => {
|
||||
write!(f, "CellPath({:?})", val.to_string())
|
||||
}
|
||||
Value::Custom { val, .. } => {
|
||||
write!(f, "CustomValue({:?})", val)
|
||||
write!(f, "CustomValue({val:?})")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user