Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix latest clippy lints #1410

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions engine/src/ast_discoverer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct PerModDiscoveries<'a> {
mod_path: Option<RustPath>,
}

impl<'b> PerModDiscoveries<'b> {
impl PerModDiscoveries<'_> {
fn deeper_path(&self, id: &Ident) -> RustPath {
match &self.mod_path {
None => RustPath::new_from_ident(id.clone()),
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion engine/src/conversion/analysis/fun/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 0 additions & 2 deletions engine/src/conversion/codegen_rs/unqualify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gen/cmd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ struct FileWriter<'a> {
written: IndexSet<String>,
}

impl<'a> FileWriter<'a> {
impl FileWriter<'_> {
fn write_placeholders<F: FnOnce(usize) -> String + Copy>(
&mut self,
mut counter: usize,
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/code_checkers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions src/reference_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl<'a, T: ?Sized> CppRef<'a, T> {
}
}

impl<'a, T: ?Sized> Deref for CppRef<'a, T> {
impl<T: ?Sized> Deref for CppRef<'_, T> {
type Target = *const T;
#[inline]
fn deref(&self) -> &Self::Target {
Expand All @@ -208,7 +208,7 @@ impl<'a, T: ?Sized> Deref for CppRef<'a, T> {
}
}

impl<'a, T: ?Sized> Clone for CppRef<'a, T> {
impl<T: ?Sized> Clone for CppRef<'_, T> {
fn clone(&self) -> Self {
Self {
ptr: self.ptr,
Expand All @@ -233,7 +233,7 @@ pub struct CppMutRef<'a, T: ?Sized> {
phantom: PhantomData<&'a T>,
}

impl<'a, T: ?Sized> CppMutRef<'a, T> {
impl<T: ?Sized> CppMutRef<'_, T> {
/// Retrieve the underlying C++ pointer.
pub fn as_mut_ptr(&self) -> *mut T {
self.ptr
Expand Down Expand Up @@ -269,7 +269,7 @@ impl<'a, T: ?Sized> CppMutRef<'a, T> {
}
}

impl<'a, T: ?Sized> Deref for CppMutRef<'a, T> {
impl<T: ?Sized> Deref for CppMutRef<'_, T> {
type Target = *const T;
#[inline]
fn deref(&self) -> &Self::Target {
Expand All @@ -283,7 +283,7 @@ impl<'a, T: ?Sized> Deref for CppMutRef<'a, T> {
}
}

impl<'a, T: ?Sized> Clone for CppMutRef<'a, T> {
impl<T: ?Sized> Clone for CppMutRef<'_, T> {
fn clone(&self) -> Self {
Self {
ptr: self.ptr,
Expand Down Expand Up @@ -316,7 +316,7 @@ pub trait AsCppMutRef<T: ?Sized>: AsCppRef<T> {
fn as_cpp_mut_ref(&mut self) -> CppMutRef<T>;
}

impl<'a, T: ?Sized> AsCppRef<T> for CppMutRef<'a, T> {
impl<T: ?Sized> AsCppRef<T> for CppMutRef<'_, T> {
fn as_cpp_ref(&self) -> CppRef<T> {
CppRef::from_ptr(self.ptr)
}
Expand Down
2 changes: 1 addition & 1 deletion src/rvalue_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ unsafe impl<T> RValueParam<T> for Pin<Box<T>> {
}
}

unsafe impl<'a, T> RValueParam<T> for Pin<MoveRef<'a, T>> {
unsafe impl<T> RValueParam<T> for Pin<MoveRef<'_, T>> {
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.
Expand Down
Loading