From 8e81ea8d1d8a25a012ab1a9b0eff25c3bff4c27f Mon Sep 17 00:00:00 2001 From: Adrian Taylor Date: Mon, 2 Dec 2024 09:52:03 +0000 Subject: [PATCH 1/2] Fix new clippy lints. --- Cargo.lock | 3 ++- engine/src/ast_discoverer.rs | 4 ++-- engine/src/conversion/analysis/fun/mod.rs | 2 +- engine/src/conversion/codegen_rs/unqualify.rs | 2 -- gen/cmd/src/main.rs | 2 +- integration-tests/tests/code_checkers.rs | 2 +- src/reference_wrapper.rs | 12 ++++++------ src/rvalue_param.rs | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 909ec21c6..4c5261aea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,7 +165,8 @@ dependencies = [ [[package]] name = "autocxx-bindgen" version = "0.70.1" -source = "git+https://github.com/adetaylor/rust-bindgen?branch=merge-0.70.1#fc466bfb6c690bb93264db324ad8d519b34d0da9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6740720b363b98ee56ffc5ee246e62185a9828c8c60f6b6f8f314d18b7a311" dependencies = [ "bitflags 2.3.3", "cexpr", diff --git a/engine/src/ast_discoverer.rs b/engine/src/ast_discoverer.rs index 6be9d8fbd..c3625b02d 100644 --- a/engine/src/ast_discoverer.rs +++ b/engine/src/ast_discoverer.rs @@ -74,7 +74,7 @@ struct PerModDiscoveries<'a> { mod_path: Option, } -impl<'b> PerModDiscoveries<'b> { +impl PerModDiscoveries<'_> { fn deeper_path(&self, id: &Ident) -> RustPath { match &self.mod_path { None => RustPath::new_from_ident(id.clone()), @@ -517,7 +517,7 @@ impl<'a> SelfSubstituter<'a> { } } -impl<'a> VisitMut for SelfSubstituter<'a> { +impl VisitMut for SelfSubstituter<'_> { fn visit_type_path_mut(&mut self, i: &mut syn::TypePath) { if i.qself.is_none() && i.path.is_ident("Self") { i.path = Path::from(self.self_ty.clone()); diff --git a/engine/src/conversion/analysis/fun/mod.rs b/engine/src/conversion/analysis/fun/mod.rs index 359c6a2fa..6dd46b57d 100644 --- a/engine/src/conversion/analysis/fun/mod.rs +++ b/engine/src/conversion/analysis/fun/mod.rs @@ -1264,7 +1264,7 @@ impl<'a> FnAnalyzer<'a> { let param_conversion_needed = param_details.iter().any(|b| b.conversion.cpp_work_needed()); let ret_type_conversion_needed = ret_type_conversion .as_ref() - .map_or(false, |x| x.cpp_work_needed()); + .is_some_and(|x| x.cpp_work_needed()); let return_needs_rust_conversion = ret_type_conversion .as_ref() .map(|ra| ra.rust_work_needed()) diff --git a/engine/src/conversion/codegen_rs/unqualify.rs b/engine/src/conversion/codegen_rs/unqualify.rs index 6f245c22c..c16f12d82 100644 --- a/engine/src/conversion/codegen_rs/unqualify.rs +++ b/engine/src/conversion/codegen_rs/unqualify.rs @@ -11,8 +11,6 @@ use syn::{ ReturnType, Token, Type, TypePath, }; -/// Mod to handle stripping paths off the front of types. - fn unqualify_type_path(typ: TypePath) -> TypePath { // If we've still got more than one // path segment then this is referring to a type within diff --git a/gen/cmd/src/main.rs b/gen/cmd/src/main.rs index 4d533ff14..be462a0e4 100644 --- a/gen/cmd/src/main.rs +++ b/gen/cmd/src/main.rs @@ -407,7 +407,7 @@ struct FileWriter<'a> { written: IndexSet, } -impl<'a> FileWriter<'a> { +impl FileWriter<'_> { fn write_placeholders String + Copy>( &mut self, mut counter: usize, diff --git a/integration-tests/tests/code_checkers.rs b/integration-tests/tests/code_checkers.rs index ae12e3c52..8fe212178 100644 --- a/integration-tests/tests/code_checkers.rs +++ b/integration-tests/tests/code_checkers.rs @@ -138,7 +138,7 @@ impl<'a> CppMatcher<'a> { } } -impl<'a> CodeCheckerFns for CppMatcher<'a> { +impl CodeCheckerFns for CppMatcher<'_> { fn check_cpp(&self, cpp: &[PathBuf]) -> Result<(), TestError> { let mut positives_needed = self.positive_matches.to_vec(); for filename in cpp { diff --git a/src/reference_wrapper.rs b/src/reference_wrapper.rs index e0d71fbff..a8fa48755 100644 --- a/src/reference_wrapper.rs +++ b/src/reference_wrapper.rs @@ -192,7 +192,7 @@ impl<'a, T: ?Sized> CppRef<'a, T> { } } -impl<'a, T: ?Sized> Deref for CppRef<'a, T> { +impl Deref for CppRef<'_, T> { type Target = *const T; #[inline] fn deref(&self) -> &Self::Target { @@ -208,7 +208,7 @@ impl<'a, T: ?Sized> Deref for CppRef<'a, T> { } } -impl<'a, T: ?Sized> Clone for CppRef<'a, T> { +impl Clone for CppRef<'_, T> { fn clone(&self) -> Self { Self { ptr: self.ptr, @@ -233,7 +233,7 @@ pub struct CppMutRef<'a, T: ?Sized> { phantom: PhantomData<&'a T>, } -impl<'a, T: ?Sized> CppMutRef<'a, T> { +impl CppMutRef<'_, T> { /// Retrieve the underlying C++ pointer. pub fn as_mut_ptr(&self) -> *mut T { self.ptr @@ -269,7 +269,7 @@ impl<'a, T: ?Sized> CppMutRef<'a, T> { } } -impl<'a, T: ?Sized> Deref for CppMutRef<'a, T> { +impl Deref for CppMutRef<'_, T> { type Target = *const T; #[inline] fn deref(&self) -> &Self::Target { @@ -283,7 +283,7 @@ impl<'a, T: ?Sized> Deref for CppMutRef<'a, T> { } } -impl<'a, T: ?Sized> Clone for CppMutRef<'a, T> { +impl Clone for CppMutRef<'_, T> { fn clone(&self) -> Self { Self { ptr: self.ptr, @@ -316,7 +316,7 @@ pub trait AsCppMutRef: AsCppRef { fn as_cpp_mut_ref(&mut self) -> CppMutRef; } -impl<'a, T: ?Sized> AsCppRef for CppMutRef<'a, T> { +impl AsCppRef for CppMutRef<'_, T> { fn as_cpp_ref(&self) -> CppRef { CppRef::from_ptr(self.ptr) } diff --git a/src/rvalue_param.rs b/src/rvalue_param.rs index e380c8a21..df1ee754c 100644 --- a/src/rvalue_param.rs +++ b/src/rvalue_param.rs @@ -63,7 +63,7 @@ unsafe impl RValueParam for Pin> { } } -unsafe impl<'a, T> RValueParam for Pin> { +unsafe impl RValueParam for Pin> { fn get_ptr(stack: Pin<&mut Self>) -> *mut T { // Safety: we won't move/swap the contents of the outer pin, nor of the // type stored within the UniquePtr. From 2f3b57f127797b964262e5cd3582251059eb1131 Mon Sep 17 00:00:00 2001 From: Adrian Taylor Date: Mon, 2 Dec 2024 09:59:59 +0000 Subject: [PATCH 2/2] Attempt to exclude macro from ASAN tests. This is no longer working on github CI. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d5d448ca..942a34864 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -175,7 +175,7 @@ jobs: # leak sanitization, but we don't care about backtraces here, so long # as the other tests have them. RUST_BACKTRACE: "0" - run: cargo -Z build-std test --workspace --target x86_64-unknown-linux-gnu + run: cargo -Z build-std test --workspace --target x86_64-unknown-linux-gnu --exclude autocxx-macro force-wrapper-generation: name: Test forcing wrapper generation