Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
LeChatP committed Apr 29, 2024
1 parent b063387 commit 8be3959
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 281 deletions.
10 changes: 4 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ fn write_doc(f: &mut File) -> Result<(), Box<dyn Error>> {
.as_bytes(),
)?;
f.write_all(
r#"#[rustfmt::skip]
r#"#[rustfmt::skip]
#[allow(clippy::all)]
pub fn get_capability_description(cap : &Cap) -> &'static str {
match *cap {
"#
Expand All @@ -89,9 +90,9 @@ pub fn get_capability_description(cap : &Cap) -> &'static str {
let desc = desc.trim().to_string();
f.write_all(
format!(
" Cap::{} => r#\"{}\"#,\n",
" Cap::{} => r#{:#?}#,\n",
name.replace("CAP_", ""),
desc
desc.replace('\n', "")
)
.as_bytes(),
)?;
Expand All @@ -102,9 +103,6 @@ pub fn get_capability_description(cap : &Cap) -> &'static str {
}"#
.as_bytes(),
)?;
Command::new("rustfmt")
.arg("src/descriptions.rs")
.output()?;
Ok(())
}

Expand Down
4 changes: 2 additions & 2 deletions src/database/finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ impl TaskMatcher<TaskMatch> for SCommands {
}

/// Check if user's groups is matching with any of the role's groups
fn match_groups(groups: &[Group], role_groups: &Vec<SGroups>) -> bool {
fn match_groups(groups: &[Group], role_groups: &[SGroups]) -> bool {
let str_groups: SGroups = groups.iter().map(|g| g.name.to_string()).collect();
for role_group in role_groups {
if *role_group <= str_groups {
Expand Down Expand Up @@ -647,7 +647,7 @@ impl CredMatcher for Rc<RefCell<SRole>> {
}
SActor::Group { groups, .. } => {
if let Some(groups) = groups.as_ref() {
if match_groups(&user.groups, &vec![groups.clone()]) {
if match_groups(&user.groups, &[groups.clone()]) {
return Some(UserMin::GroupMatch(user.groups.len()));
}
}
Expand Down
Loading

0 comments on commit 8be3959

Please sign in to comment.