Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita72a1c7

Browse files
authored
Merge pull request#8203 from gabelluardo/add-clippy-rules
Enable some pedantic rules
2 parents213389c +8c69980 commita72a1c7

File tree

8 files changed

+14
-17
lines changed

8 files changed

+14
-17
lines changed

‎Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ needless_pass_by_value = "allow" # 16
657657
float_cmp ="allow"# 12
658658
items_after_statements ="allow"# 11
659659
return_self_not_must_use ="allow"# 8
660-
redundant_else ="allow"# 6
661660
needless_continue ="allow"# 6
662661
inline_always ="allow"# 6
663662
fn_params_excessive_bools ="allow"# 6

‎src/uu/chroot/src/chroot.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ fn parse_group_list(list_str: &str) -> Result<Vec<String>, ChrootError> {
9595
if name.is_empty(){
9696
// --groups=","
9797
continue;
98-
}else{
99-
// --groups=", "
100-
// chroot: invalid group ' '
101-
show!(ChrootError::InvalidGroup(name.to_string()));
102-
err =true;
10398
}
99+
100+
// --groups=", "
101+
// chroot: invalid group ' '
102+
show!(ChrootError::InvalidGroup(name.to_string()));
103+
err =true;
104104
}else{
105105
// TODO Figure out a better condition here.
106106
if trimmed_name.starts_with(char::is_numeric)

‎src/uu/cp/src/cp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,10 +2662,10 @@ fn handle_no_preserve_mode(options: &Options, org_mode: u32) -> u32 {
26622662
constMODE_RW_UGO:u32 =
26632663
(S_IRUSR |S_IWUSR |S_IRGRP |S_IWGRP |S_IROTH |S_IWOTH)asu32;
26642664
constS_IRWXUGO:u32 =(S_IRWXU |S_IRWXG |S_IRWXO)asu32;
2665-
if is_explicit_no_preserve_mode{
2666-
returnMODE_RW_UGO;
2665+
returnif is_explicit_no_preserve_mode{
2666+
MODE_RW_UGO
26672667
}else{
2668-
returnorg_mode&S_IRWXUGO;
2668+
org_mode&S_IRWXUGO
26692669
};
26702670
}
26712671
}

‎src/uu/head/src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mod tests {
152152
}
153153

154154
fnobsolete_result(src:&[&str]) ->Option<Result<Vec<String>,ParseError>>{
155-
Some(Ok(src.iter().map(|s|(*s).to_string()).collect()))
155+
Some(Ok(src.iter().map(|&s|s.to_string()).collect()))
156156
}
157157

158158
#[test]

‎src/uu/id/src/id.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
217217
set_exit_code(1);
218218
if i +1 >= users.len(){
219219
break;
220-
}else{
221-
continue;
222220
}
221+
222+
continue;
223223
}
224224
}
225225
}else{

‎src/uu/stty/src/stty.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,9 +916,8 @@ fn string_to_control_char(s: &str) -> Result<u8, ControlCharMappingError> {
916916
ifletSome(val) = ascii_num{
917917
if val >255{
918918
returnErr(ControlCharMappingError::IntOutOfRange(s.to_string()));
919-
}else{
920-
returnOk(valasu8);
921919
}
920+
returnOk(valasu8);
922921
}
923922
// try to parse ^<char> or just <char>
924923
letmut chars = s.chars();

‎src/uu/sync/src/sync.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ mod platform {
143143
get_message("sync-error-find-next-volume"),
144144
)),
145145
};
146-
}else{
147-
volumes.push(String::from_wide_null(&name));
148146
}
147+
volumes.push(String::from_wide_null(&name));
149148
}
150149
}
151150

‎src/uu/uptime/src/uptime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ fn process_utmpx(file: Option<&OsString>) -> (Option<time_t>, usize) {
242242
boot_time =Some(dt.unix_timestamp()astime_t);
243243
}
244244
}
245-
_ =>continue,
245+
_ =>(),
246246
}
247247
}
248248
(boot_time, nusers)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp