File tree Expand file tree Collapse file tree 6 files changed +22
-11
lines changed Expand file tree Collapse file tree 6 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,12 @@ use std::collections::HashMap;
1212pub ( 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 }
Original file line number Diff line number Diff 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} ) ;
Original file line number Diff line number Diff line change 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) ]
Original file line number Diff line number Diff 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
8283pub fn get_api ( ) -> & ' static sys:: GodotApi {
8384 unsafe { GODOT_API . as_ref ( ) . unwrap_or_else ( || std:: process:: abort ( ) ) }
8485}
Original file line number Diff line number Diff 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) ;
Original file line number Diff line number Diff line change 1- #![ allow( clippy:: blacklisted_name) ]
1+ #![ allow( clippy:: blacklisted_name, clippy :: if_then_panic ) ]
22
33use gdnative:: prelude:: * ;
44
You can’t perform that action at this time.
0 commit comments