Skip to content

Commit

Permalink
Fix clippy::explicit_iter_loop (#1453)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmondal authored Nov 2, 2024
1 parent cb5d0bc commit 973f210
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 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,-Dclippy::redundant_else,-Dclippy::return_self_not_must_use,-Dclippy::match_same_arms
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,-Dclippy::return_self_not_must_use,-Dclippy::match_same_arms,-Dclippy::explicit_iter_loop
build --@rules_rust//:clippy.toml=//:clippy.toml

test --@rules_rust//:rustfmt.toml=//:.rustfmt.toml
Expand Down
4 changes: 2 additions & 2 deletions nativelink-metric/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl<U: ToString, T: MetricsComponent> MetricsComponent for HashMap<U, T> {
kind: MetricKind,
field_metadata: MetricFieldData,
) -> Result<MetricPublishKnownKindData, Error> {
for (key, item) in self.iter() {
for (key, item) in self {
let guard = group!(key).entered();
let publish_result = item.publish(kind, field_metadata.clone())?;
drop(guard);
Expand Down Expand Up @@ -217,7 +217,7 @@ impl<U: ToString, T: MetricsComponent> MetricsComponent for BTreeMap<U, T> {
kind: MetricKind,
field_metadata: MetricFieldData,
) -> Result<MetricPublishKnownKindData, Error> {
for (key, item) in self.iter() {
for (key, item) in self {
group!(key).in_scope(|| item.publish(kind, field_metadata.clone()))?;
}
Ok(MetricPublishKnownKindData::Component)
Expand Down
2 changes: 1 addition & 1 deletion nativelink-service/src/cas_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl CasServer {
.clone();

let mut requested_blobs = Vec::with_capacity(request.blob_digests.len());
for digest in request.blob_digests.iter() {
for digest in &request.blob_digests {
requested_blobs.push(DigestInfo::try_from(digest.clone())?.into());
}
let sizes = store
Expand Down

0 comments on commit 973f210

Please sign in to comment.