Skip to content

Commit d0fcfa5

Browse files
committed
run "cargo clippy --fix --all" to inline some string interpolations.
Note: this is more strict than required
1 parent 20cd346 commit d0fcfa5

File tree

27 files changed

+35
-41
lines changed

27 files changed

+35
-41
lines changed

godot-bindings/src/godot_version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Current path: /Users/runner/work/gdext/gdext/godot-core
132132
custom_rev,
133133
};
134134
let parsed: GodotVersion = parse_godot_version(full).unwrap();
135-
assert_eq!(parsed, expected, "{}", full);
135+
assert_eq!(parsed, expected, "{full}");
136136
}
137137

138138
for full in bad_versions {

godot-codegen/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl<'a> Context<'a> {
247247
*self
248248
.method_table_indices
249249
.get(key)
250-
.unwrap_or_else(|| panic!("did not register table index for key {:?}", key))
250+
.unwrap_or_else(|| panic!("did not register table index for key {key:?}"))
251251
}
252252

253253
/// Whether an interface trait is generated for a class.

godot-codegen/src/generator/builtins.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn make_builtin_class(
9999
ty: outer_class, ..
100100
} = conv::to_rust_type(godot_name, None, ctx)
101101
else {
102-
panic!("Rust type `{}` categorized wrong", godot_name)
102+
panic!("Rust type `{godot_name}` categorized wrong")
103103
};
104104
let inner_class = class.inner_name();
105105

godot-codegen/src/generator/default_parameters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn make_function_definition_with_defaults(
2929

3030
let simple_fn_name = safe_ident(sig.name());
3131
let extended_fn_name = format_ident!("{}_ex", simple_fn_name);
32-
let default_parameter_usage = format!("To set the default parameters, use [`Self::{}`] and its builder methods. See [the book](https://godot-rust.github.io/book/godot-api/functions.html#default-parameters) for detailed usage instructions.", extended_fn_name);
32+
let default_parameter_usage = format!("To set the default parameters, use [`Self::{extended_fn_name}`] and its builder methods. See [the book](https://godot-rust.github.io/book/godot-api/functions.html#default-parameters) for detailed usage instructions.");
3333
let vis = functions_common::make_vis(sig.is_private());
3434

3535
let (builder_doc, surround_class_prefix) = make_extender_doc(sig, &extended_fn_name);

godot-codegen/src/generator/docs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn make_class_doc(
7171
};
7272

7373
let notes = special_cases::get_class_extra_docs(class_name)
74-
.map(|notes| format!("# Specific notes for this class\n\n{}", notes))
74+
.map(|notes| format!("# Specific notes for this class\n\n{notes}"))
7575
.unwrap_or_default();
7676

7777
format!(
@@ -102,7 +102,7 @@ pub fn make_virtual_trait_doc(
102102
);
103103

104104
let notes = special_cases::get_interface_extra_docs(trait_name_str)
105-
.map(|notes| format!("# Specific notes for this interface\n\n{}", notes))
105+
.map(|notes| format!("# Specific notes for this interface\n\n{notes}"))
106106
.unwrap_or_default();
107107

108108
// Detect if a base interface exists. This is not the case if intermediate Godot classes are marked "abstract" (aka final for GDExtension).

godot-codegen/src/generator/extension_interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn generate_proc_address_funcs(h_path: &Path) -> TokenStream {
5454
doc,
5555
} = fptr;
5656

57-
let name_str = Literal::byte_string(format!("{}\0", name).as_bytes());
57+
let name_str = Literal::byte_string(format!("{name}\0").as_bytes());
5858

5959
let decl = quote! {
6060
#[doc = #doc]

godot-codegen/src/generator/functions_common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ impl LifetimeGen {
427427

428428
let mut tokens = quote! { < };
429429
for i in 0..self.count {
430-
let lft = lifetime(&format!("a{}", i));
430+
let lft = lifetime(&format!("a{i}"));
431431
tokens.extend(quote! { #lft, });
432432
}
433433
tokens.extend(quote! { > });

godot-codegen/src/generator/method_tables.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,7 @@ fn make_method_table(info: IndexedMethodTable) -> TokenStream {
337337
assert_eq!(
338338
last.method_inits.last().unwrap().index,
339339
method_count - 1,
340-
"last method should have highest index (table {})",
341-
table_name
340+
"last method should have highest index (table {table_name})"
342341
);
343342
} else {
344343
assert_eq!(method_count, 0, "empty method table should have count 0");

godot-codegen/src/generator/native_structures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ fn make_native_structure_field_and_accessor(
244244
fn normalize_native_structure_field_type(field_type: &str) -> String {
245245
if field_type.contains("::") {
246246
let with_dot = field_type.replace("::", ".");
247-
format!("enum::{}", with_dot)
247+
format!("enum::{with_dot}")
248248
} else {
249249
field_type.to_string()
250250
}

godot-codegen/src/generator/signals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl SignalParams {
308308
write!(formatted_types, ", ").unwrap();
309309
}
310310

311-
write!(formatted_types, "{}: {}", param_name, formatted_ty).unwrap();
311+
write!(formatted_types, "{param_name}: {formatted_ty}").unwrap();
312312
}
313313

314314
Self {

0 commit comments

Comments
 (0)