pass clippy

This commit is contained in:
Romulus21
2024-08-24 15:37:20 +02:00
parent 7518a715ba
commit 261a29d3bf
3 changed files with 8 additions and 12 deletions

View File

@@ -9,13 +9,11 @@ pub fn read_env_var() {
fs::read_to_string(path).expect("Something went wrong reading the file : device.env");
if let Ok(lines) = read_lines(path) {
for line in lines {
if let Ok(var) = line {
for var in lines.map_while(Result::ok) {
let new_var: Vec<&str> = var.split('=').collect();
env::set_var(new_var[0], new_var[1]);
}
}
}
/*
println!("\n");

View File

@@ -41,7 +41,7 @@ pub fn get_topic_name(types: &str) -> String {
let capteur = env::var("CAPTEUR").unwrap().to_string();
topic.push_str(&capteur);
topic.push('/');
topic.push_str(&types);
topic.push_str(types);
topic
}

View File

@@ -12,7 +12,7 @@ pub fn get_temperature() -> f32 {
let temperature_string = &String::from_utf8_lossy(&temperature_command.stdout)[..5];
temperature = temperature_string.parse::<f32>().unwrap();
temperature = temperature / 1000.0;
temperature /= 1000.0;
} else {
let temperature_command = Command::new("sudo")
.arg("/opt/vc/bin/vcgencmd")
@@ -39,9 +39,8 @@ pub fn get_storage() -> i8 {
let vec_storage: Vec<&str> = storage_string.split_whitespace().collect();
let mut value = vec_storage[vec_storage.len() - 2].to_string();
value.pop();
let storage = value.parse::<i8>().unwrap();
storage
value.parse::<i8>().unwrap()
}
pub fn get_mem() -> i8 {
@@ -54,9 +53,8 @@ pub fn get_mem() -> i8 {
let vec_mem: Vec<&str> = mem_string.split_whitespace().collect();
let total = vec_mem[7].parse::<f32>().unwrap();
let mem_use = vec_mem[8].parse::<f32>().unwrap();
let result = (mem_use / total * 100.0) as i8;
result
(mem_use / total * 100.0) as i8
}
pub fn get_battery() -> i8 {
@@ -70,7 +68,7 @@ pub fn get_battery() -> i8 {
.unwrap_or_else(|e| panic!("failed to execute process: {}", e));
let battery_string = &String::from_utf8_lossy(&battery_command.stdout);
battery = (&battery_string[..battery_string.len() - 1])
battery = (battery_string[..battery_string.len() - 1])
.parse::<i8>()
.unwrap();
}