Skip to content

Commit ac14a39

Browse files
committed
Clippy lints in nightly
1 parent ef7e096 commit ac14a39

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

bindings_generator/src/classes.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ use std::collections::HashMap;
1212
pub(crate) fn generate_class_struct(class: &GodotClass) -> TokenStream {
1313
let class_name = format_ident!("{}", &class.name);
1414

15+
// dead_code: 'this' might not be read
1516
quote! {
1617
#[allow(non_camel_case_types)]
1718
#[derive(Debug)]
1819
pub struct #class_name {
20+
#[allow(dead_code)]
1921
this: RawObject<Self>,
2022
}
2123
}

gdnative-core/src/core_types/dictionary.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,11 @@ godot_test!(test_dictionary {
625625
let expected_keys = ["foo", "bar"].iter().map(|&s| s.to_string()).collect::<HashSet<_>>();
626626
for (key, value) in &dict {
627627
assert_eq!(Some(value), dict.get(&key));
628-
if !iter_keys.insert(key.to_string()) {
629-
panic!("key is already contained in set: {:?}", key);
630-
}
628+
assert!(
629+
iter_keys.insert(key.to_string()) ,
630+
"key is already contained in set: {:?}",
631+
key
632+
);
631633
}
632634
assert_eq!(expected_keys, iter_keys);
633635
});

gdnative-core/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
//! [thread-safety]: https://docs.godotengine.org/en/stable/tutorials/threads/thread_safe_apis.html
2121
2222
#![deny(clippy::missing_inline_in_public_items)]
23-
#![allow(clippy::transmute_ptr_to_ptr)]
23+
#![allow(
24+
clippy::transmute_ptr_to_ptr,
25+
clippy::missing_safety_doc,
26+
clippy::if_then_panic
27+
)]
2428
#![cfg_attr(feature = "gd_test", allow(clippy::blacklisted_name))]
2529

2630
#[doc(hidden)]

gdnative-core/src/private.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ unsafe fn check_api_compatibility(
7979
/// not bound will lead to an abort**, since in most cases there is simply no point to continue
8080
/// if `get_api` failed. This allows it to be used in FFI contexts without a `catch_unwind`.
8181
#[inline]
82+
#[allow(clippy::redundant_closure)] // clippy false positive: https://github.com/rust-lang/rust-clippy/issues/7812
8283
pub fn get_api() -> &'static sys::GodotApi {
8384
unsafe { GODOT_API.as_ref().unwrap_or_else(|| std::process::abort()) }
8485
}

gdnative-sys/build.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ mod header_binding {
6464
// and have been erroneously used for target platforms in this library in the past. Make sure
6565
// to double-check them wherever they occur.
6666

67-
if !cfg!(target_arch = "x86_64") {
68-
panic!("unsupported host architecture: build from x86_64 instead");
69-
}
67+
assert!(
68+
cfg!(target_arch = "x86_64"),
69+
"unsupported host architecture: build from x86_64 instead"
70+
);
7071

7172
builder = builder
7273
.clang_arg("-I")
@@ -457,9 +458,10 @@ mod api_wrapper {
457458

458459
for api in api_root.all_apis() {
459460
// Currently don't support Godot 4.0
460-
if api.version.major == 1 && api.version.minor == 3 {
461-
panic!("GodotEngine v4.* is not yet supported. See https://github.com/godot-rust/godot-rust/issues/396");
462-
}
461+
assert!(
462+
!(api.version.major == 1 && api.version.minor == 3),
463+
"GodotEngine v4.* is not yet supported. See https://github.com/godot-rust/godot-rust/issues/396"
464+
);
463465
}
464466

465467
let struct_fields = godot_api_functions(&api_root);

test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::blacklisted_name)]
1+
#![allow(clippy::blacklisted_name, clippy::if_then_panic)]
22

33
use gdnative::prelude::*;
44

0 commit comments

Comments
 (0)