Skip to content

Commit 507ae8d

Browse files
committed
clippy
1 parent 977866e commit 507ae8d

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

src/app_config.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ impl AppConfig {
1818
let mut config = if let Some(config_file) = &cli.config_file {
1919
if !config_file.is_file() {
2020
return Err(anyhow::anyhow!(
21-
"Configuration file does not exist: {:?}",
22-
config_file
21+
"Configuration file does not exist: {}",
22+
config_file.display()
2323
));
2424
}
2525
log::debug!("Loading configuration from file: {}", config_file.display());
@@ -85,14 +85,14 @@ impl AppConfig {
8585
fn validate(&self) -> anyhow::Result<()> {
8686
if !self.web_root.is_dir() {
8787
return Err(anyhow::anyhow!(
88-
"Web root is not a valid directory: {:?}",
89-
self.web_root
88+
"Web root is not a valid directory: {}",
89+
self.web_root.display()
9090
));
9191
}
9292
if !self.configuration_directory.is_dir() {
9393
return Err(anyhow::anyhow!(
94-
"Configuration directory is not a valid directory: {:?}",
95-
self.configuration_directory
94+
"Configuration directory is not a valid directory: {}",
95+
self.configuration_directory.display()
9696
));
9797
}
9898
if self.database_connection_acquire_timeout_seconds <= 0.0 {

src/filesystem.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ impl FileSystem {
160160
}
161161
} else {
162162
anyhow::bail!(
163-
"Unsupported path: {path:?}. Path component '{component:?}' is not allowed."
164-
);
163+
"Unsupported path: {}. Path component '{component:?}' is not allowed.",
164+
path.display()
165+
);
165166
}
166167
}
167168
}

src/render.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl HeaderContext {
211211
Some("none") => actix_web::cookie::SameSite::None,
212212
Some("lax") => actix_web::cookie::SameSite::Lax,
213213
None | Some("strict") => actix_web::cookie::SameSite::Strict, // strict by default
214-
Some(other) => bail!("Cookie: invalid value for same_site: {}", other),
214+
Some(other) => bail!("Cookie: invalid value for same_site: {other}"),
215215
});
216216
let secure = obj.get("secure");
217217
cookie.set_secure(secure != Some(&json!(false)) && secure != Some(&json!(0)));
@@ -392,7 +392,7 @@ async fn verify_password_async(
392392
) -> Result<Result<(), password_hash::Error>, anyhow::Error> {
393393
tokio::task::spawn_blocking(move || {
394394
let hash = password_hash::PasswordHash::new(&password_hash)
395-
.map_err(|e| anyhow::anyhow!("invalid value for the password_hash property: {}", e))?;
395+
.map_err(|e| anyhow::anyhow!("invalid value for the password_hash property: {e}"))?;
396396
let phfs = &[&argon2::Argon2::default() as &dyn password_hash::PasswordVerifier];
397397
Ok(hash.verify_password(phfs, password))
398398
})
@@ -735,7 +735,7 @@ impl<W: std::io::Write> HtmlRenderContext<W> {
735735
data: &JsonValue,
736736
) -> anyhow::Result<()> {
737737
if Self::is_shell_component(component_name) {
738-
bail!("There cannot be more than a single shell per page. You are trying to open the {} component, but a shell component is already opened for the current page. You can fix this by removing the extra shell component, or by moving this component to the top of the SQL file, before any other component that displays data.", component_name);
738+
bail!("There cannot be more than a single shell per page. You are trying to open the {component_name} component, but a shell component is already opened for the current page. You can fix this by removing the extra shell component, or by moving this component to the top of the SQL file, before any other component that displays data.");
739739
}
740740

741741
if component_name == "log" {

src/webserver/database/execute_queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ fn debug_row(r: &AnyRow) {
302302
}
303303

304304
fn clone_anyhow_err(source_file: &Path, err: &anyhow::Error) -> anyhow::Error {
305-
let mut e = anyhow!("{source_file:?} contains a syntax error preventing SQLPage from parsing and preparing its SQL statements.");
305+
let mut e = anyhow!("{} contains a syntax error preventing SQLPage from parsing and preparing its SQL statements.", source_file.display());
306306
for c in err.chain().rev() {
307307
e = e.context(c.to_string());
308308
}

src/webserver/database/sqlpage_functions/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ pub(crate) async fn hash_password(password: Option<String>) -> anyhow::Result<Op
347347
let phf = argon2::Argon2::default();
348348
let salt = password_hash::SaltString::generate(&mut password_hash::rand_core::OsRng);
349349
let password_hash = &password_hash::PasswordHash::generate(phf, password, &salt)
350-
.map_err(|e| anyhow!("Unable to hash password: {}", e))?;
350+
.map_err(|e| anyhow!("Unable to hash password: {e}"))?;
351351
Ok(password_hash.to_string())
352352
})
353353
.await?

src/webserver/database/syntax_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub(super) async fn extract_req_param<'a>(
176176
get_val.map(SingleOrVec::as_json_str)
177177
}
178178
}
179-
StmtParam::Error(x) => anyhow::bail!("{}", x),
179+
StmtParam::Error(x) => anyhow::bail!("{x}"),
180180
StmtParam::Literal(x) => Some(Cow::Owned(x.clone())),
181181
StmtParam::Null => None,
182182
StmtParam::Concat(args) => concat_params(&args[..], request, db_connection).await?,

src/webserver/oidc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl OidcState {
221221
let nonce_verifier = |nonce: Option<&Nonce>| check_nonce(nonce, expected_nonce);
222222
let claims: OidcClaims = id_token
223223
.into_claims(&verifier, nonce_verifier)
224-
.map_err(|e| anyhow::anyhow!("Could not verify the ID token: {}", e))?;
224+
.map_err(|e| anyhow::anyhow!("Could not verify the ID token: {e}"))?;
225225
Ok(claims)
226226
}
227227
}

0 commit comments

Comments
 (0)