mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Use variable names directly in the format strings (#7906)
# Description Lint: `clippy::uninlined_format_args` More readable in most situations. (May be slightly confusing for modifier format strings https://doc.rust-lang.org/std/fmt/index.html#formatting-parameters) Alternative to #7865 # User-Facing Changes None intended # Tests + Formatting (Ran `cargo +stable clippy --fix --workspace -- -A clippy::all -D clippy::uninlined_format_args` to achieve this. Depends on Rust `1.67`)
This commit is contained in:
committed by
GitHub
parent
6ae497eedc
commit
ab480856a5
@ -180,21 +180,21 @@ impl UrlComponents {
|
||||
.iter()
|
||||
.zip(vals.iter())
|
||||
.map(|(k, v)| match v.as_string() {
|
||||
Ok(val) => Ok(format!("{}={}", k, val)),
|
||||
Ok(val) => Ok(format!("{k}={val}")),
|
||||
Err(err) => Err(err),
|
||||
})
|
||||
.collect::<Result<Vec<String>, ShellError>>()?
|
||||
.join("&");
|
||||
|
||||
qs = format!("?{}", qs);
|
||||
qs = format!("?{qs}");
|
||||
|
||||
if let Some(q) = self.query {
|
||||
if q != qs {
|
||||
// if query is present it means that also query_span is set.
|
||||
return Err(ShellError::IncompatibleParameters {
|
||||
left_message: format!("Mismatch, qs from params is: {}", qs),
|
||||
left_message: format!("Mismatch, qs from params is: {qs}"),
|
||||
left_span: value.expect_span(),
|
||||
right_message: format!("instead query is: {}", q),
|
||||
right_message: format!("instead query is: {q}"),
|
||||
right_span: self.query_span.unwrap_or(Span::unknown()),
|
||||
});
|
||||
}
|
||||
@ -241,7 +241,7 @@ impl UrlComponents {
|
||||
path: Some(if s.starts_with('/') {
|
||||
s
|
||||
} else {
|
||||
format!("/{}", s)
|
||||
format!("/{s}")
|
||||
}),
|
||||
..self
|
||||
}),
|
||||
@ -250,16 +250,16 @@ impl UrlComponents {
|
||||
if q != s {
|
||||
// if query is present it means that also params_span is set.
|
||||
return Err(ShellError::IncompatibleParameters {
|
||||
left_message: format!("Mismatch, query param is: {}", s),
|
||||
left_message: format!("Mismatch, query param is: {s}"),
|
||||
left_span: value.expect_span(),
|
||||
right_message: format!("instead qs from params is: {}", q),
|
||||
right_message: format!("instead qs from params is: {q}"),
|
||||
right_span: self.params_span.unwrap_or(Span::unknown()),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
query: Some(format!("?{}", s)),
|
||||
query: Some(format!("?{s}")),
|
||||
query_span: Some(value.expect_span()),
|
||||
..self
|
||||
})
|
||||
@ -268,7 +268,7 @@ impl UrlComponents {
|
||||
fragment: Some(if s.starts_with('#') {
|
||||
s
|
||||
} else {
|
||||
format!("#{}", s)
|
||||
format!("#{s}")
|
||||
}),
|
||||
..self
|
||||
}),
|
||||
@ -285,7 +285,7 @@ impl UrlComponents {
|
||||
|
||||
if let Some(usr) = &self.username {
|
||||
if let Some(pwd) = &self.password {
|
||||
user_and_pwd = format!("{}:{}@", usr, pwd);
|
||||
user_and_pwd = format!("{usr}:{pwd}@");
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ impl UrlComponents {
|
||||
user_and_pwd,
|
||||
host_result?,
|
||||
self.port
|
||||
.map(|p| format!(":{}", p))
|
||||
.map(|p| format!(":{p}"))
|
||||
.as_deref()
|
||||
.unwrap_or_default(),
|
||||
self.path.as_deref().unwrap_or_default(),
|
||||
|
Reference in New Issue
Block a user