Make clippy happy

axtloss/rework-partitioning
axtloss 2 years ago
parent 660407638d
commit acd5f935e6

@ -5,7 +5,7 @@ use std::path::PathBuf;
use log::warn;
pub fn install_base_packages(kernel: String) {
let mut kernel_to_install: String = String::new();
let kernel_to_install: String;
std::fs::create_dir_all("/mnt/etc").unwrap();
files::copy_file("/etc/pacman.conf", "/mnt/etc/pacman.conf");
if kernel.is_empty() {

@ -154,6 +154,7 @@ pub fn setup_unakite(root: &str, oldroot: &str, efi: bool, efidir: &str, bootdev
"unakite",
true,
"Cp7oN04ZY0PsA", // unakite
false,
);
exec_eval(
exec(

@ -5,7 +5,7 @@ use std::process::Command;
pub fn new_user(username: &str, hasroot: bool, password: &str, do_hash_pass: bool) {
if do_hash_pass {
let hashed_pass = &*hash_pass(password).stdout;
let password = match std::str::from_utf8(hashed_pass) {
let _password = match std::str::from_utf8(hashed_pass) {
Ok(v) => v,
Err(e) => panic!("Failed to hash password, invalid UTF-8 sequence {}", e),
};
@ -18,7 +18,7 @@ pub fn new_user(username: &str, hasroot: bool, password: &str, do_hash_pass: boo
String::from("-s"),
String::from("/bin/bash"),
String::from("-p"),
String::from(password).replace("\n", ""),
String::from(password).replace('\n', ""),
String::from(username),
],
),
@ -56,7 +56,7 @@ pub fn hash_pass(password: &str) -> std::process::Output {
])
.output()
.expect("Failed to hash password");
return output;
output
}

@ -32,9 +32,7 @@ pub fn copy_file(path: &str, destpath: &str) {
pub fn append_file(path: &str, content: &str) -> std::io::Result<()> {
log::info!("Append '{}' to file {}", content.trim_end(), path);
let mut file = OpenOptions::new().append(true).open(path)?;
file.write_all("\n".as_bytes())?;
file.write_all(content.as_bytes())?;
file.write("\n".as_bytes())?;
file.write_all(format!("\n{content}\n").as_bytes())?;
Ok(())
}

Loading…
Cancel
Save