Skip to content

Commit 76b59f7

Browse files
diliopfacebook-github-bot
authored andcommitted
fix clippy lints
Summary: [`clippy::uninlined_format_args`](https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args) will become an error on OSS buck2 builds with the `1.88.0` toolchain since `clippy::all` so fixing these first here via: ``` $ buck2 run fbcode//common/rust/tools/rustfix2:rustfix -- --clippy --target fbcode//buck2/app/... --target fbcode//buck2/allocative/... --target fbcode//buck2/buck2_tpx_cli/... --target fbcode//buck2/dice/... --target fbcode//buck2/dice_replay/... --target fbcode//buck2/facebook/... --target fbcode//buck2/gazebo/... --target fbcode//buck2/host_sharing/... --target fbcode//buck2/integrations/... --target fbcode//buck2/remote_execution/... --target fbcode//buck2/shed/... --target fbcode//buck2/starlark-rust/... --target fbcode//buck2/superconsole/... $ find fbcode/buck2/ -name *.rs | xargs arc lint --take RUSTFMT -a ``` plus some manual fixes for `build.rs` files and OSS-only code blocks. Reviewed By: capickett Differential Revision: D78065152 fbshipit-source-id: 544d9bcabed0bb08d4fcf38410a46592e477093a
1 parent a43b5e6 commit 76b59f7

File tree

105 files changed

+281
-331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+281
-331
lines changed

allocative/allocative/src/flamegraph.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,7 @@ mod tests {
565565
Struct;p;x 13\n\
566566
",
567567
tree.to_flame_graph().0.write(),
568-
"{:#?}",
569-
tree,
568+
"{tree:#?}",
570569
);
571570
}
572571

@@ -602,8 +601,7 @@ mod tests {
602601
Struct;p 12\n\
603602
",
604603
tree.to_flame_graph().0.write(),
605-
"{:#?}",
606-
tree,
604+
"{tree:#?}",
607605
);
608606
}
609607

allocative/allocative/src/golden.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn make_golden<T: Allocative>(value: &T) -> (String, String) {
5353
header = golden_header()
5454
.lines()
5555
.fold(String::new(), |mut output, line| {
56-
let _ = writeln!(output, "# {}", line);
56+
let _ = writeln!(output, "# {line}");
5757
output
5858
})
5959
);

allocative/allocative_derive/src/derive_allocative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn fields_unnamed_names(fields: &FieldsUnnamed) -> syn::Result<Vec<Ident>> {
233233
.unnamed
234234
.iter()
235235
.enumerate()
236-
.map(|(i, f)| Ok(Ident::new(&format!("f{}", i), f.span())))
236+
.map(|(i, f)| Ok(Ident::new(&format!("f{i}"), f.span())))
237237
.collect()
238238
}
239239

gazebo/display_container/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ mod tests {
302302
"]",
303303
": ",
304304
// just wrap with `"` to make it clearer in the output
305-
self.0.iter().map(|(k, v)| (k, format!("\"{}\"", v))),
305+
self.0.iter().map(|(k, v)| (k, format!("\"{v}\""))),
306306
)
307307
}
308308
}

gazebo/dupe_derive/src/dupe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn derive_dupe_explicit(
5454
let check_each_field_dupe = check_each_field_dupe(all_fields);
5555

5656
let check_func_name = Ident::new(
57-
&format!("__implicit_dupe_check_for_fields_of_{}", name),
57+
&format!("__implicit_dupe_check_for_fields_of_{name}"),
5858
name.span(),
5959
);
6060

gazebo/dupe_derive/src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn duplicate_variant(data: &Variant, duplicate: &TokenStream) -> TokenStream {
9999
.iter()
100100
.enumerate()
101101
.map(|(i, f)| {
102-
let var = Ident::new(&format!("v{}", i), f.span());
102+
let var = Ident::new(&format!("v{i}"), f.span());
103103
(quote! {#var}, quote! {#duplicate(#var)})
104104
})
105105
.unzip();

gazebo/gazebo_derive/src/variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub(crate) fn derive_unpack_variants(input: DeriveInput) -> syn::Result<proc_mac
7878
for field in variant.fields.iter() {
7979
patterns.push(field.ident.clone().map_or_else(
8080
|| {
81-
let id = Ident::new(&format!("_v{}", count), Span::call_site());
81+
let id = Ident::new(&format!("_v{count}"), Span::call_site());
8282
count += 1;
8383
id
8484
},

gazebo/strong_hash_derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub fn derive_hash(input: TokenStream) -> TokenStream {
7070
.iter()
7171
.enumerate()
7272
.map(|(index, field)| {
73-
Ident::new(&format!("x{}", index), field.span())
73+
Ident::new(&format!("x{index}"), field.span())
7474
})
7575
.collect();
7676
quote! {

starlark/src/analysis/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl Display for EvalMessage {
138138
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
139139
write!(f, "{}: {}:", self.severity, self.path)?;
140140
if let Some(span) = self.span {
141-
write!(f, "{}", span)?;
141+
write!(f, "{span}")?;
142142
}
143143
write!(f, " {}", self.description)
144144
}
@@ -162,7 +162,7 @@ impl EvalMessage {
162162
span: None,
163163
severity: EvalSeverity::Error,
164164
name: "error".to_owned(),
165-
description: format!("{:#}", x),
165+
description: format!("{x:#}"),
166166
full_error_with_span: None,
167167
original: None,
168168
}
@@ -180,7 +180,7 @@ impl EvalMessage {
180180
span: Some(resolved_span),
181181
severity: EvalSeverity::Error,
182182
name: "error".to_owned(),
183-
description: format!("{:#}", message),
183+
description: format!("{message:#}"),
184184
full_error_with_span: Some(full_error.to_string()),
185185
original: Some(original),
186186
}

starlark/src/analysis/unused_loads/find.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub(crate) fn find_unused_loads(
130130

131131
for top in top_level_stmts(&module_scopes.cst) {
132132
top.visit_ident(|ident| {
133-
println!("visit ident: {:?}", ident);
133+
println!("visit ident: {ident:?}");
134134
let ResolvedIdent::Slot(Slot::Module(_), binding_id) = ident
135135
.payload
136136
.ok_or_else(|| anyhow::anyhow!("ident is not resolved (internal error)"))?

0 commit comments

Comments
 (0)