Skip to content

Commit

Permalink
Fix clippy::redundant_else (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
SchahinRohani authored Oct 24, 2024
1 parent 4948580 commit 6ed0455
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ build --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect
build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect

# TODO(aaronmondal): Extend these flags until we can run with clippy::pedantic.
build --@rules_rust//:clippy_flags=-Dwarnings,-Dclippy::uninlined_format_args,-Dclippy::manual_string_new,-Dclippy::manual_let_else,-Dclippy::single_match_else,-Dclippy::redundant_closure_for_method_calls,-Dclippy::semicolon_if_nothing_returned,-Dclippy::unreadable_literal,-Dclippy::range_plus_one,-Dclippy::inconsistent_struct_constructor,-Dclippy::match_wildcard_for_single_variants,-Dclippy::implicit_clone,-Dclippy::needless_pass_by_value,-Dclippy::explicit_deref_methods,-Dclippy::trivially_copy_pass_by_ref,-Dclippy::unnecessary_wraps,-Dclippy::cast_lossless,-Dclippy::map_unwrap_or,-Dclippy::ref_as_ptr,-Dclippy::inline_always
build --@rules_rust//:clippy_flags=-Dwarnings,-Dclippy::uninlined_format_args,-Dclippy::manual_string_new,-Dclippy::manual_let_else,-Dclippy::single_match_else,-Dclippy::redundant_closure_for_method_calls,-Dclippy::semicolon_if_nothing_returned,-Dclippy::unreadable_literal,-Dclippy::range_plus_one,-Dclippy::inconsistent_struct_constructor,-Dclippy::match_wildcard_for_single_variants,-Dclippy::implicit_clone,-Dclippy::needless_pass_by_value,-Dclippy::explicit_deref_methods,-Dclippy::trivially_copy_pass_by_ref,-Dclippy::unnecessary_wraps,-Dclippy::cast_lossless,-Dclippy::map_unwrap_or,-Dclippy::ref_as_ptr,-Dclippy::inline_always,-Dclippy::redundant_else
build --@rules_rust//:clippy.toml=//:clippy.toml

test --@rules_rust//:rustfmt.toml=//:.rustfmt.toml
Expand Down
3 changes: 1 addition & 2 deletions nativelink-scheduler/src/simple_scheduler_state_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,8 @@ where
if err.code == Code::Aborted {
last_err = Some(err);
continue;
} else {
return Err(err);
}
return Err(err);
}
return Ok(());
}
Expand Down
25 changes: 12 additions & 13 deletions nativelink-store/src/redis_utils/ft_aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,19 @@ where
loop {
if let Some(map) = state.data.data.pop_front() {
return Some((Ok(map), Some(state)));
} else {
if state.data.cursor == 0 {
return None;
}
let data_res = state
.client
.ft_cursor_read(state.index.clone(), state.data.cursor, None)
.await;
state.data = match data_res {
Ok(data) => data,
Err(err) => return Some((Err(err), None)),
};
continue;
}
if state.data.cursor == 0 {
return None;
}
let data_res = state
.client
.ft_cursor_read(state.index.clone(), state.data.cursor, None)
.await;
state.data = match data_res {
Ok(data) => data,
Err(err) => return Some((Err(err), None)),
};
continue;
}
},
))
Expand Down
3 changes: 1 addition & 2 deletions nativelink-util/src/resource_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,8 @@ fn recursive_parse<'a>(
output.compressor = Some(Cow::Borrowed(part));
*bytes_processed += part.len() + SLASH_SIZE;
return Ok(state);
} else {
return Err(make_input_err!("Expected compressor, got {part}"));
}
return Err(make_input_err!("Expected compressor, got {part}"));
}
State::DigestFunction => {
state = State::Hash;
Expand Down

0 comments on commit 6ed0455

Please sign in to comment.