From cdfb1f1a2cf8327b2399f796783b0e1dc3339774 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 09:36:09 +0000 Subject: [PATCH] Format Rust code using rustfmt --- rar-common/src/database/options.rs | 36 +++++++++++++----------------- rar-common/src/util.rs | 2 +- src/chsr/cli/mod.rs | 8 +++++-- src/sr/main.rs | 7 ++++-- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/rar-common/src/database/options.rs b/rar-common/src/database/options.rs index 3b9534d..1b6983d 100644 --- a/rar-common/src/database/options.rs +++ b/rar-common/src/database/options.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; -use std::{borrow::Borrow, cell::RefCell, rc::Rc}; #[cfg(feature = "finder")] use std::path::PathBuf; +use std::{borrow::Borrow, cell::RefCell, rc::Rc}; use chrono::Duration; @@ -551,18 +551,18 @@ pub struct OptStack { } type FinalPath = ( - PathBehavior, - Rc>>, - Rc>>, - ); + PathBehavior, + Rc>>, + Rc>>, +); type FinalEnv = ( - EnvBehavior, - HashMap, - LinkedHashSet, - LinkedHashSet, - LinkedHashSet, - ); + EnvBehavior, + HashMap, + LinkedHashSet, + LinkedHashSet, + LinkedHashSet, +); impl OptStack { pub fn from_task(task: Rc>) -> Self { @@ -610,7 +610,7 @@ impl OptStack { fn new(roles: Rc>) -> OptStack { let mut res = OptStack::default(); - let mut opt = Opt{ + let mut opt = Opt { level: Level::Global, root: Some(SPrivileged::User), bounding: Some(SBounding::Strict), @@ -696,9 +696,7 @@ impl OptStack { } } - fn get_final_path( - &self, - ) -> FinalPath { + fn get_final_path(&self) -> FinalPath { let mut final_behavior = PathBehavior::Delete; let final_add = rc_refcell!(LinkedHashSet::new()); // Cannot use HashSet as we need to keep order @@ -747,9 +745,7 @@ impl OptStack { #[allow(dead_code)] #[cfg(not(tarpaulin_include))] - fn union_all_path( - &self, - ) -> FinalPath { + fn union_all_path(&self) -> FinalPath { let mut final_behavior = PathBehavior::Delete; let final_add = rc_refcell!(LinkedHashSet::new()); // Cannot use HashSet as we need to keep order @@ -877,9 +873,7 @@ impl OptStack { Ok(final_env) } - fn get_final_env( - &self, - ) -> FinalEnv { + fn get_final_env(&self) -> FinalEnv { let mut final_behavior = EnvBehavior::default(); let mut final_set = HashMap::new(); let mut final_keep = LinkedHashSet::new(); diff --git a/rar-common/src/util.rs b/rar-common/src/util.rs index 6266ade..15b264d 100644 --- a/rar-common/src/util.rs +++ b/rar-common/src/util.rs @@ -16,9 +16,9 @@ use strum::EnumIs; use tracing::{debug, warn, Level}; use tracing_subscriber::util::SubscriberInitExt; -use crate::database::structs::SCommand; #[cfg(feature = "finder")] use crate::api::PluginManager; +use crate::database::structs::SCommand; pub const RST: &str = "\x1B[0m"; pub const BOLD: &str = "\x1B[1m"; diff --git a/src/chsr/cli/mod.rs b/src/chsr/cli/mod.rs index bae5e21..2c5b127 100644 --- a/src/chsr/cli/mod.rs +++ b/src/chsr/cli/mod.rs @@ -72,9 +72,13 @@ mod tests { .try_init(); //Write json test json file let path = format!("{}.{}", ROOTASROLE, name); - let mut file = std::fs::File::create(path.clone()).unwrap_or_else(|_| panic!("Failed to create {:?}/{} file at", + let mut file = std::fs::File::create(path.clone()).unwrap_or_else(|_| { + panic!( + "Failed to create {:?}/{} file at", current_dir().unwrap(), - path)); + path + ) + }); let mut settings = SettingsFile::default(); settings.storage.method = StorageMethod::JSON; settings.storage.settings = Some(RemoteStorageSettings::default()); diff --git a/src/sr/main.rs b/src/sr/main.rs index b4fd0b3..c088f40 100644 --- a/src/sr/main.rs +++ b/src/sr/main.rs @@ -267,7 +267,11 @@ fn main() -> Result<(), Box> { let pty = Pty::new().expect("Failed to create pty"); - debug!("Command: {:?} {:?}", execcfg.exec_path, execcfg.exec_args.join(" ")); + debug!( + "Command: {:?} {:?}", + execcfg.exec_path, + execcfg.exec_args.join(" ") + ); let command = Command::new(&execcfg.exec_path) .args(execcfg.exec_args.iter()) .env_clear() @@ -319,7 +323,6 @@ fn make_cred() -> Cred { // get parent pid let ppid = nix::unistd::getppid(); - Cred { user, groups,