apply some simple clippy lints

This commit is contained in:
auronandace
2025-06-30 17:11:48 +01:00
parent a86aec193d
commit 721d49adfb
3 changed files with 7 additions and 9 deletions
+2 -2
View File
@@ -98,7 +98,7 @@ fn main() {
Ok(data) => {
config.files.push(redox_installer::FileConfig {
path: "pkg/id_ed25519.pub.toml".to_string(),
data: data,
data,
..Default::default()
});
Some(path)
@@ -143,7 +143,7 @@ fn main() {
None
};
if let Some(path) = parser.args.get(0) {
if let Some(path) = parser.args.first() {
if let Err(err) = redox_installer::install(
config,
path,
+1 -1
View File
@@ -70,7 +70,7 @@ impl DiskWrapper {
remaining,
self.block
.len()
.checked_sub(offset.try_into().unwrap())
.checked_sub(offset)
.unwrap(),
);
+4 -6
View File
@@ -45,7 +45,7 @@ fn get_target() -> String {
/// Converts a password to a serialized argon2rs hash, understandable
/// by redox_users. If the password is blank, the hash is blank.
fn hash_password(password: &str) -> Result<String> {
if password != "" {
if !password.is_empty() {
let salt = format!("{:X}", OsRng.next_u64());
let config = argon2::Config::default();
let hash = argon2::hash_encoded(password.as_bytes(), salt.as_bytes(), &config)?;
@@ -159,7 +159,7 @@ fn install_packages(config: &Config, dest: &str, cookbook: Option<&str>) {
}
}
} else {
for (packagename, _package) in &config.packages {
for packagename in config.packages.keys() {
println!("Installing package from remote: {}", packagename);
library
.install(vec![pkg::PackageName::new(packagename).unwrap()])
@@ -422,10 +422,8 @@ where
format!("/tmp/redox_installer_{}", process::id())
};
if cfg!(not(target_os = "redox")) {
if !Path::new(&mount_path).exists() {
fs::create_dir(&mount_path)?;
}
if cfg!(not(target_os = "redox")) && !Path::new(&mount_path).exists() {
fs::create_dir(&mount_path)?;
}
let ctime = SystemTime::now().duration_since(UNIX_EPOCH)?;