[desktop] Fix all clippy warning. Add clippy to CI.

This commit is contained in:
Vladimir Stoilov
2024-08-02 17:50:15 +03:00
parent 9472a1f8f5
commit 4c340f7b70
13 changed files with 208 additions and 167 deletions

View File

@@ -26,7 +26,7 @@ impl From<std::process::Output> for ServiceManagerError {
.ok()
.filter(|s| !s.trim().is_empty())
})
.unwrap_or_else(|| format!("Failed to run `systemctl`"));
.unwrap_or_else(|| "Failed to run `systemctl`".to_string());
ServiceManagerError::Other(output.status, msg)
}
@@ -231,11 +231,11 @@ fn trim_newline(s: &mut String) {
}
fn get_sudo_cmd() -> std::result::Result<SudoCommand, std::io::Error> {
if let Ok(_) = fs::metadata("/usr/bin/pkexec") {
if fs::metadata("/usr/bin/pkexec").is_ok() {
return Ok(SudoCommand::Pkexec);
}
if let Ok(_) = fs::metadata("/usr/bin/gksudo") {
if fs::metadata("/usr/bin/gksudo").is_ok() {
return Ok(SudoCommand::Gksu);
}