Skip to content

Commit 9a1ffd1

Browse files
committed
cargo: clippy (updated version)
1 parent 631892a commit 9a1ffd1

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

rar-common/src/database/score.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl From<&DGroupType<'_>> for SetgidMin {
104104
impl From<&Vec<u32>> for SetgidMin {
105105
fn from(s: &Vec<u32>) -> Self {
106106
SetgidMin {
107-
is_root: s.iter().any(|id| *id == 0),
107+
is_root: s.contains(&0),
108108
nb_groups: s.len(),
109109
}
110110
}

rar-common/src/util.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ pub fn write_json_config<T: Serialize>(settings: &T, file: &mut impl Write) -> s
313313

314314
pub fn write_cbor_config<T: Serialize>(settings: &T, file: &mut impl Write) -> std::io::Result<()> {
315315
cbor4ii::serde::to_writer(file, &settings).map_err(|e| {
316-
std::io::Error::new(
317-
std::io::ErrorKind::Other,
316+
std::io::Error::other(
318317
format!("Failed to write cbor config: {}", e),
319318
)
320319
})

src/sr/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ mod tests {
183183
let sr_error: SrError = not_found.into();
184184
assert_eq!(sr_error, SrError::ExecutionFailed);
185185

186-
let other = std::io::Error::new(std::io::ErrorKind::Other, "test");
186+
let other = std::io::Error::other("test");
187187
let sr_error: SrError = other.into();
188188
assert_eq!(sr_error, SrError::SystemError);
189189
}

src/sr/finder/cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn match_path(
2424
info!("match_path: found better match {:?}", min);
2525
*final_path = Some(user_path.clone());
2626
}
27-
return min;
27+
min
2828
} else {
2929
debug!("match_path: user relative path");
3030
let mut curmin = CmdMin::empty();

src/sr/finder/de.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,12 +968,12 @@ impl<'de: 'a, 'a> DeserializeSeed<'de> for SetGroupsDeserializerReturn<'a> {
968968
}
969969
Field::Add => {
970970
debug!("SGroupsChooserVisitor: add");
971-
if filter.is_some() {
971+
if let Some(filter) = filter {
972972
let add = map.next_value::<Cow<'_, [DGroups]>>()?;
973973
for group in add.iter() {
974974
let v: Vec<u32> =
975975
group.try_into().map_err(serde::de::Error::custom)?;
976-
if v == *filter.unwrap() {
976+
if v == *filter {
977977
ok = true;
978978
groups = Some(group.to_owned());
979979
score.replace(group.into());
@@ -1164,13 +1164,13 @@ impl<'de: 'a, 'a> DeserializeSeed<'de> for SetUserDeserializerReturn<'a> {
11641164
}
11651165
Field::Add => {
11661166
debug!("SUserChooserVisitor: add");
1167-
if filter.is_some() {
1167+
if let Some(filter) = filter {
11681168
let users = map.next_value::<Cow<'_, [DUserType]>>()?;
11691169
for user_item in users.iter() {
11701170
let user_id = user_item
11711171
.fetch_id()
11721172
.ok_or(serde::de::Error::custom("User does not exist"))?;
1173-
if user_id == *filter.unwrap() {
1173+
if user_id == *filter {
11741174
ok = true;
11751175
user = Some(user_item.to_owned());
11761176
score.replace(user_item.into());

src/sr/pam/rpassword.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ fn read_unbuffered(source: &mut impl io::Read) -> io::Result<PamBuffer> {
7979
let mut pwd_iter = password.iter_mut();
8080

8181
const EOL: u8 = 0x0A;
82+
#[allow(clippy::unbuffered_bytes)] // we want unbuffered reading for passwords
8283
let input = source.bytes().take_while(|x| x.as_ref().ok() != Some(&EOL));
8384

8485
for read_byte in input {

0 commit comments

Comments
 (0)