Skip to content

Commit 3e9a9ed

Browse files
committed
Simplify value-iteration over arrays
Also simplifies a few other iterations. Arrays did not implement IntoIterator until Rust 1.56: https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html
1 parent 5e58f6b commit 3e9a9ed

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

bindings-generator/src/classes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub(crate) fn generate_class_constants(class: &GodotClass) -> TokenStream {
7676
class.constants.iter().collect();
7777
class_constants.sort_by(constant_sorter);
7878

79-
for (name, value) in &class_constants {
79+
for (name, value) in class_constants {
8080
let name = format_ident!("{}", name);
8181
let constant = quote! {
8282
pub const #name: i64 = #value;

bindings-generator/src/godot_version.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ fn test_godot_versions() {
5454
];
5555

5656
// From Rust 1.56: 'for (...) in good_versions'
57-
for (full, major, minor, patch, stability) in good_versions.iter().cloned() {
57+
for (full, major, minor, patch, stability) in good_versions {
5858
let parsed: GodotVersion = parse_godot_version(full).unwrap();
5959
assert_eq!(parsed.major, major);
6060
assert_eq!(parsed.minor, minor);
6161
assert_eq!(parsed.patch, patch);
6262
assert_eq!(parsed.stability, stability);
6363
}
6464

65-
for full in bad_versions.iter() {
65+
for full in bad_versions {
6666
let parsed = parse_godot_version(full);
6767
assert!(parsed.is_err());
6868
}

bindings-generator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ pub(crate) mod test_prelude {
225225

226226
let api = Api::new(include_str!("../../gdnative-bindings/api.json"));
227227
let mut buffer = BufWriter::new(Vec::with_capacity(16384));
228-
for class in &api.classes {
228+
for class in api.classes {
229229
let mut icalls = HashMap::new();
230230

231231
let code = generate_module_doc(&class);

gdnative-derive/src/native_script.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
287287
let attr_args_builder = property_args
288288
.get_or_insert_with(|| PropertyAttrArgsBuilder::new(&field.ty));
289289

290-
for arg in &nested {
290+
for arg in nested {
291291
if let NestedMeta::Meta(Meta::NameValue(ref pair)) = arg {
292292
attr_args_builder.add_pair(pair)?;
293293
} else if let NestedMeta::Meta(Meta::Path(ref path)) = arg {
@@ -473,9 +473,9 @@ mod tests {
473473
(attr_getp_setp, true, true),
474474
];
475475

476-
for (attr, allowed_bare, allowed_property) in &combinations {
477-
check_property_combination(attr, quote! { i32 }, *allowed_bare);
478-
check_property_combination(attr, quote! { Property<i32> }, *allowed_property);
476+
for (attr, allowed_bare, allowed_property) in combinations {
477+
check_property_combination(&attr, quote! { i32 }, allowed_bare);
478+
check_property_combination(&attr, quote! { Property<i32> }, allowed_property);
479479
}
480480
}
481481

gdnative-derive/src/varargs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(crate) fn derive_from_varargs(input: DeriveInput) -> Result<TokenStream2, sy
4848

4949
let mut required = Vec::new();
5050
let mut optional = Vec::new();
51-
for field in fields.iter() {
51+
for field in fields {
5252
let is_optional = field.attrs.iter().any(|attr| attr.path.is_ident("opt"));
5353
if !is_optional && !optional.is_empty() {
5454
return Err(syn::Error::new(

0 commit comments

Comments
 (0)