Skip to content

Commit aecab4a

Browse files
authored
Merge pull request #762 from godot-rust/qol/clippy-maintenance
Clippy fixes for Rust 1.79
2 parents 7eec09c + e5d4d8d commit aecab4a

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

godot-codegen/src/models/json.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
// TODO remove this warning once impl is complete
99
// Several types have #[allow(dead_code)], can be subsequently removed.
1010

11-
#![allow(clippy::question_mark)] // in #[derive(DeJson)]
11+
// In #[derive(DeJson)].
12+
#![allow(clippy::question_mark)]
13+
//
14+
// This file acts as deserialization check of the JSON file. Even if some fields are unused, having them declared makes sure they're
15+
// deserializable and conform to our expectations. It also doesn't add much value to annotate individual fields; it doesn't really
16+
// matter if some are unused because it's external input data.
17+
#![allow(dead_code)]
1218

1319
use nanoserde::DeJson;
1420

godot-macros/src/class/data_models/field_var.rs

-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ impl GetterSetterImpl {
195195
let export_token = make_method_registration(
196196
class_name,
197197
FuncDefinition {
198-
signature: signature.clone(),
199198
signature_info: into_signature_info(signature, class_name, false),
200199
// Since we're analyzing a struct's field, we don't have access to the corresponding get/set function's
201200
// external (non-#[func]) attributes. We have to assume the function exists and has the name the user
@@ -205,7 +204,6 @@ impl GetterSetterImpl {
205204
external_attributes: Vec::new(),
206205
rename: None,
207206
is_script_virtual: false,
208-
has_gd_self: false,
209207
},
210208
);
211209

godot-macros/src/class/data_models/func.rs

-3
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@ use quote::{format_ident, quote};
1212

1313
/// Information used for registering a Rust function with Godot.
1414
pub struct FuncDefinition {
15-
/// Raw information about the Rust function.
16-
pub signature: venial::Function,
1715
/// Refined signature, with higher level info and renamed parameters.
1816
pub signature_info: SignatureInfo,
1917
/// The function's non-gdext attributes (all except #[func]).
2018
pub external_attributes: Vec<venial::Attribute>,
2119
/// The name the function will be exposed as in Godot. If `None`, the Rust function name is used.
2220
pub rename: Option<String>,
2321
pub is_script_virtual: bool,
24-
pub has_gd_self: bool,
2522
}
2623

2724
/// Returns a C function which acts as the callback when a virtual method of this instance is invoked.

godot-macros/src/class/data_models/inherent_impl.rs

-2
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,10 @@ fn process_godot_fns(
176176
};
177177

178178
func_definitions.push(FuncDefinition {
179-
signature,
180179
signature_info,
181180
external_attributes,
182181
rename,
183182
is_script_virtual: is_virtual,
184-
has_gd_self,
185183
});
186184
}
187185
ItemAttrType::Signal(ref _attr_val) => {

itest/repo-tweak/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use std::collections::HashMap;
1010
#[derive(Debug)]
1111
pub struct Match {
1212
/// Position before pattern start marker.
13+
#[allow(dead_code)] // False-positive, regression introduced in Rust 1.79.
1314
pub before_start: usize,
1415

1516
/// Position at the beginning of the repetition (after marker + keys).

itest/rust/src/object_tests/object_swap_test.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ macro_rules! swapped_free {
3434
let mut rhs = $rhs;
3535

3636
// Standard DerefMut no longer works, as it checks the RTTI which then panics.
37-
// std::mem::swap(&mut *lhs, &mut *rhs);
37+
// #[allow]: we don't know the types inside the macro, and Rust still doesn't have typeof/decltype.
38+
#[allow(clippy::missing_transmute_annotations)]
3839
std::mem::swap(&mut lhs, unsafe { std::mem::transmute(&mut rhs) });
3940

4041
lhs.free();

0 commit comments

Comments
 (0)