Skip to content

Commit c51984b

Browse files
authored
Merge pull request #3181 from itowlson/clippy-1.88-moar-moar-moar
The, er, rest of the Clippy 1.88 lints
2 parents 7c3184c + 14180a2 commit c51984b

File tree

22 files changed

+48
-56
lines changed

22 files changed

+48
-56
lines changed

crates/compose/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,12 @@ impl std::str::FromStr for ImportName {
474474
if s.contains([':', '/']) {
475475
let (package, rest) = s
476476
.split_once('/')
477-
.with_context(|| format!("invalid import name: {}", s))?;
477+
.with_context(|| format!("invalid import name: {s}"))?;
478478

479479
let (interface, version) = match rest.split_once('@') {
480480
Some((interface, version)) => {
481481
let version = Version::parse(version)
482-
.with_context(|| format!("invalid version in import name: {}", s))?;
482+
.with_context(|| format!("invalid version in import name: {s}"))?;
483483

484484
(interface, Some(version))
485485
}

crates/expressions/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl<'a> Key<'a> {
254254
.chars()
255255
.find(|c| !(c.is_ascii_lowercase() || c.is_ascii_digit() || c == &'_'))
256256
{
257-
Err(format!("invalid character {:?}. Variable names may contain only lower-case letters, numbers, and underscores.", invalid))
257+
Err(format!("invalid character {invalid:?}. Variable names may contain only lower-case letters, numbers, and underscores."))
258258
} else if !key.bytes().next().unwrap().is_ascii_lowercase() {
259259
Err("must start with a lowercase ASCII letter".to_string())
260260
} else if !key.bytes().last().unwrap().is_ascii_alphanumeric() {

crates/expressions/src/template.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Display for Template {
5555
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5656
self.parts().try_for_each(|part| match part {
5757
Part::Lit(lit) => f.write_str(lit),
58-
Part::Expr(expr) => write!(f, "{{ {} }}", expr),
58+
Part::Expr(expr) => write!(f, "{{ {expr} }}"),
5959
})
6060
}
6161
}

crates/factor-outbound-http/src/wasi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ async fn send_request_handler(
228228
authority.to_string()
229229
} else {
230230
let port = if use_tls { 443 } else { 80 };
231-
format!("{}:{port}", authority)
231+
format!("{authority}:{port}")
232232
}
233233
} else {
234234
return Err(ErrorCode::HttpRequestUriInvalid);

crates/factor-outbound-mysql/src/client.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Client for MysqlClient {
5555

5656
self.exec_batch(&statement, &[parameters])
5757
.await
58-
.map_err(|e| v2::Error::QueryFailed(format!("{:?}", e)))
58+
.map_err(|e| v2::Error::QueryFailed(format!("{e:?}")))
5959
}
6060

6161
async fn query(
@@ -69,7 +69,7 @@ impl Client for MysqlClient {
6969
let mut query_result = self
7070
.exec_iter(&statement, parameters)
7171
.await
72-
.map_err(|e| v2::Error::QueryFailed(format!("{:?}", e)))?;
72+
.map_err(|e| v2::Error::QueryFailed(format!("{e:?}")))?;
7373

7474
// We have to get these before collect() destroys them
7575
let columns = convert_columns(query_result.columns());
@@ -193,8 +193,7 @@ fn convert_entry(
193193
match (row.take(index), columns.get(index)) {
194194
(None, _) => Ok(DbValue::DbNull), // TODO: is this right or is this an "index out of range" thing
195195
(_, None) => Err(v2::Error::Other(format!(
196-
"Can't get column at index {}",
197-
index
196+
"Can't get column at index {index}"
198197
))),
199198
(Some(mysql_async::Value::NULL), _) => Ok(DbValue::DbNull),
200199
(Some(value), Some(column)) => convert_value(value, column),
@@ -261,7 +260,7 @@ fn build_opts(address: &str) -> Result<Opts, mysql_async::Error> {
261260
}
262261

263262
fn convert_value_to<T: FromValue>(value: mysql_async::Value) -> Result<T, v2::Error> {
264-
from_value_opt::<T>(value).map_err(|e| v2::Error::ValueConversionFailed(format!("{}", e)))
263+
from_value_opt::<T>(value).map_err(|e| v2::Error::ValueConversionFailed(format!("{e}")))
265264
}
266265

267266
#[cfg(test)]

crates/factor-outbound-pg/src/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Client for TokioClient {
6060
.iter()
6161
.map(to_sql_parameter)
6262
.collect::<Result<Vec<_>>>()
63-
.map_err(|e| v3::Error::ValueConversionFailed(format!("{:?}", e)))?;
63+
.map_err(|e| v3::Error::ValueConversionFailed(format!("{e:?}")))?;
6464

6565
let params_refs: Vec<&(dyn ToSql + Sync)> = params
6666
.iter()
@@ -69,7 +69,7 @@ impl Client for TokioClient {
6969

7070
self.execute(&statement, params_refs.as_slice())
7171
.await
72-
.map_err(|e| v3::Error::QueryFailed(format!("{:?}", e)))
72+
.map_err(|e| v3::Error::QueryFailed(format!("{e:?}")))
7373
}
7474

7575
async fn query(
@@ -81,7 +81,7 @@ impl Client for TokioClient {
8181
.iter()
8282
.map(to_sql_parameter)
8383
.collect::<Result<Vec<_>>>()
84-
.map_err(|e| v3::Error::BadParameter(format!("{:?}", e)))?;
84+
.map_err(|e| v3::Error::BadParameter(format!("{e:?}")))?;
8585

8686
let params_refs: Vec<&(dyn ToSql + Sync)> = params
8787
.iter()
@@ -91,7 +91,7 @@ impl Client for TokioClient {
9191
let results = self
9292
.query(&statement, params_refs.as_slice())
9393
.await
94-
.map_err(|e| v3::Error::QueryFailed(format!("{:?}", e)))?;
94+
.map_err(|e| v3::Error::QueryFailed(format!("{e:?}")))?;
9595

9696
if results.is_empty() {
9797
return Ok(RowSet {
@@ -105,7 +105,7 @@ impl Client for TokioClient {
105105
.iter()
106106
.map(convert_row)
107107
.collect::<Result<Vec<_>, _>>()
108-
.map_err(|e| v3::Error::QueryFailed(format!("{:?}", e)))?;
108+
.map_err(|e| v3::Error::QueryFailed(format!("{e:?}")))?;
109109

110110
Ok(RowSet { columns, rows })
111111
}

crates/factor-outbound-pg/src/host.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<C: Client> InstanceState<C> {
5151
ports
5252
.get(i)
5353
.or_else(|| if ports.len() == 1 { ports.get(1) } else { None });
54-
let port_str = port.map(|p| format!(":{}", p)).unwrap_or_default();
54+
let port_str = port.map(|p| format!(":{p}")).unwrap_or_default();
5555
let url = format!("{address}{port_str}");
5656
if !self.allowed_hosts.check_url(&url, "postgres").await? {
5757
return Ok(false);

crates/http/src/wagi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn build_headers(
4242
// accompanied by a message-body entity. The CONTENT_LENGTH value must
4343
// reflect the length of the message-body after the server has removed
4444
// any transfer-codings or content-codings.
45-
headers.insert("CONTENT_LENGTH".to_owned(), format!("{}", content_length));
45+
headers.insert("CONTENT_LENGTH".to_owned(), format!("{content_length}"));
4646

4747
// CONTENT_TYPE (from the spec)
4848
// The server MUST set this meta-variable if an HTTP Content-Type field is present

crates/key-value-azure/src/store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ impl AzureCosmosStore {
441441
}
442442

443443
fn get_query(&self, key: &str) -> String {
444-
let mut query = format!("SELECT * FROM c WHERE c.id='{}'", key);
444+
let mut query = format!("SELECT * FROM c WHERE c.id='{key}'");
445445
self.append_store_id(&mut query, true);
446446
query
447447
}
@@ -459,7 +459,7 @@ impl AzureCosmosStore {
459459
.collect::<Vec<String>>()
460460
.join(", ");
461461

462-
let mut query = format!("SELECT * FROM c WHERE c.id IN ({})", in_clause);
462+
let mut query = format!("SELECT * FROM c WHERE c.id IN ({in_clause})");
463463
self.append_store_id(&mut query, true);
464464
query
465465
}

crates/manifest/src/compat/allowed_http_hosts.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,17 @@ fn parse_allowed_http_host_from_unschemed(text: &str) -> Result<AllowedHttpHost,
7272
// Host name parsing is quite hairy (thanks, IPv6), so punt it off to the
7373
// Url type which gets paid big bucks to do it properly. (But preserve the
7474
// original un-URL-ified string for use in error messages.)
75-
let urlised = format!("http://{}", text);
75+
let urlised = format!("http://{text}");
7676
let fake_url = Url::parse(&urlised)
77-
.map_err(|_| format!("{} isn't a valid host or host:port string", text))?;
77+
.map_err(|_| format!("{text} isn't a valid host or host:port string"))?;
7878
parse_allowed_http_host_from_http_url(&fake_url, text)
7979
}
8080

8181
fn parse_allowed_http_host_from_schemed(text: &str) -> Result<AllowedHttpHost, String> {
82-
let url =
83-
Url::parse(text).map_err(|e| format!("{} isn't a valid HTTP host URL: {}", text, e))?;
82+
let url = Url::parse(text).map_err(|e| format!("{text} isn't a valid HTTP host URL: {e}"))?;
8483

8584
if !matches!(url.scheme(), "http" | "https") {
86-
return Err(format!("{} isn't a valid host or host:port string", text));
85+
return Err(format!("{text} isn't a valid host or host:port string"));
8786
}
8887

8988
parse_allowed_http_host_from_http_url(&url, text)
@@ -92,13 +91,12 @@ fn parse_allowed_http_host_from_schemed(text: &str) -> Result<AllowedHttpHost, S
9291
fn parse_allowed_http_host_from_http_url(url: &Url, text: &str) -> Result<AllowedHttpHost, String> {
9392
let host = url
9493
.host_str()
95-
.ok_or_else(|| format!("{} doesn't contain a host name", text))?;
94+
.ok_or_else(|| format!("{text} doesn't contain a host name"))?;
9695

9796
let has_path = url.path().len() > 1; // allow "/"
9897
if has_path {
9998
return Err(format!(
100-
"{} contains a path, should be host and optional port only",
101-
text
99+
"{text} contains a path, should be host and optional port only"
102100
));
103101
}
104102

0 commit comments

Comments
 (0)