Skip to content

Commit

Permalink
fix clippy code
Browse files Browse the repository at this point in the history
  • Loading branch information
dobefore committed Feb 7, 2023
1 parent e65b2f5 commit affe61e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ async fn main() -> Result<(), ()> {
// Display config
if matches.default {
let default_yaml = Config::default().to_string().expect("Failed to serialize.");
println!("{}", default_yaml);
println!("{default_yaml}");
return Ok(());
}
// read config file if needed
let conf = match parse_args::config_from_arguments(&matches) {
Ok(c) => c,
Err(e) => {
eprintln!("Error while getting configuration: {}", e);
eprintln!("Error while getting configuration: {e}");
return Err(());
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/parse_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ pub fn config_from_arguments(arg: &Arg) -> Result<Config, ApplicationError> {
/// Manage user
pub fn manage_user(cmd: &UserCommand, auth_path: &str) {
if let Err(e) = user_manage(cmd, auth_path) {
panic!("Error managing users: {}", e);
panic!("Error managing users: {e}");
};
}
6 changes: 2 additions & 4 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,13 @@ pub async fn host_key(
})
} else {
Err(UserError::Authentication(format!(
"Authentication failed for user {}",
username
"Authentication failed for user {username}"
))
.into())
}
}
None => Err(UserError::Authentication(format!(
"Authentication failed for nonexistent user {}",
username
"Authentication failed for nonexistent user {username}"
))
.into()),
}
Expand Down
4 changes: 2 additions & 2 deletions src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub fn user_manage<P: AsRef<Path>>(cmd: &UserCommand, dbpath: P) -> Result<(), U
if *list {
let user_list = user_list(&dbpath)?;
if let Some(v) = user_list {
v.into_iter().for_each(|i| println!("{}", i));
v.into_iter().for_each(|i| println!("{i}"));
}
}
}
Expand Down Expand Up @@ -167,7 +167,7 @@ fn create_pass_hash(username: &str, password: &str, salt: &str) -> String {
hasher.update(salt);
// read hash digest and consume hasher
let result = hasher.finalize();
let pass_hash = format!("{:x}{}", result, salt);
let pass_hash = format!("{result:x}{salt}");
pass_hash
}
/// extract salt from a hash which is the last 16 characters
Expand Down

0 comments on commit affe61e

Please sign in to comment.