From 6fcb3bb32df1b2728d8066103a49c0723ce77edc Mon Sep 17 00:00:00 2001 From: Schahin Date: Fri, 25 Oct 2024 13:41:27 +0200 Subject: [PATCH] Fix clippy::return_self_not_must_use (#1435) --- .bazelrc | 2 +- nativelink-util/src/health_utils.rs | 1 + nativelink-util/src/store_trait.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 8f12d46c2..bde5ec6be 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 +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 build --@rules_rust//:clippy.toml=//:clippy.toml test --@rules_rust//:rustfmt.toml=//:.rustfmt.toml diff --git a/nativelink-util/src/health_utils.rs b/nativelink-util/src/health_utils.rs index 80b29bea0..2107fd63a 100644 --- a/nativelink-util/src/health_utils.rs +++ b/nativelink-util/src/health_utils.rs @@ -141,6 +141,7 @@ impl HealthRegistryBuilder { } /// Create a sub builder for a namespace. + #[must_use] pub fn sub_builder(&mut self, namespace: &str) -> HealthRegistryBuilder { HealthRegistryBuilder { namespace: format!("{}/{}", self.namespace, namespace).into(), diff --git a/nativelink-util/src/store_trait.rs b/nativelink-util/src/store_trait.rs index 63c3671ca..8a37932da 100644 --- a/nativelink-util/src/store_trait.rs +++ b/nativelink-util/src/store_trait.rs @@ -167,6 +167,7 @@ impl<'a> StoreKey<'a> { /// Returns a shallow clone of the key. /// This is extremely cheap and should be used when clone /// is needed but the key is not going to be modified. + #[must_use] pub fn borrow(&'a self) -> StoreKey<'a> { match self { StoreKey::Str(Cow::Owned(s)) => StoreKey::Str(Cow::Borrowed(s)),