Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanshade committed Aug 15, 2023
1 parent 3bc4f42 commit 769d955
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
20 changes: 16 additions & 4 deletions src/cxx_auto_artifact_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ fn emit_impl_moveit_copy_new(
#[inline]
unsafe fn copy_new(that: &Self, this: ::core::pin::Pin<&mut ::core::mem::MaybeUninit<Self>>) {
let this = this.get_unchecked_mut().as_mut_ptr();
self::ffi::cxx_copy_new(this, that)
self::ffi::cxx_copy_new(this, that);
}
}
})
Expand All @@ -426,7 +426,7 @@ fn emit_impl_moveit_move_new(
) {
let this = this.get_unchecked_mut().as_mut_ptr();
let that = &mut *::core::pin::Pin::into_inner_unchecked(that);
self::ffi::cxx_move_new(this, that)
self::ffi::cxx_move_new(this, that);
}
}
})
Expand Down Expand Up @@ -532,8 +532,15 @@ fn emit_impl_partial_ord(
} else {
None
};
Some(syn::parse_quote! {
impl #generics_binder ::core::cmp::PartialOrd for #ident #generics {
let partial_cmp: syn::ImplItemFn = if info.is_rust_ord {
syn::parse_quote! {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<::core::cmp::Ordering> {
Some(self.cmp(other))
}
}
} else {
syn::parse_quote! {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<::core::cmp::Ordering> {
let res = self::ffi::cxx_operator_three_way_comparison(self, other);
Expand All @@ -548,6 +555,11 @@ fn emit_impl_partial_ord(
None
}
}
}
};
Some(syn::parse_quote! {
impl #generics_binder ::core::cmp::PartialOrd for #ident #generics {
#partial_cmp
#lt
#le
#gt
Expand Down
37 changes: 36 additions & 1 deletion src/cxx_auto_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'ctx> CxxAutoEntry<'ctx> {
let cxx_namespace = #cxx_namespace;
let cxx_name = #cxx_name;
let rust_name = #rust_name;
let lifetimes = ::cxx_auto::indexmap::IndexMap::from_iter([#(#lifetimes),*].into_iter());
let lifetimes = ::cxx_auto::indexmap::IndexMap::from_iter([#(#lifetimes),*]);
let align = self::ffi::cxx_abi_align();
let size = self::ffi::cxx_abi_size();
let cxx_has_operator_equal = self::ffi::cxx_has_operator_equal();
Expand Down Expand Up @@ -134,40 +134,75 @@ impl<'ctx> CxxAutoEntry<'ctx> {
#namespace
unsafe extern "C++" {
include!(#include);
#[must_use]
fn cxx_abi_align() -> usize;
#[must_use]
fn cxx_abi_size() -> usize;
#[must_use]
fn cxx_is_copy_constructible() -> bool;
#[must_use]
fn cxx_is_move_constructible() -> bool;
#[must_use]
fn cxx_is_default_constructible() -> bool;
#[must_use]
fn cxx_is_destructible() -> bool;
#[must_use]
fn cxx_is_trivially_copyable() -> bool;
#[must_use]
fn cxx_is_trivially_movable() -> bool;
#[must_use]
fn cxx_is_trivially_destructible() -> bool;
#[must_use]
fn cxx_is_equality_comparable() -> bool;
#[must_use]
fn cxx_has_operator_equal() -> bool;
#[must_use]
fn cxx_has_operator_not_equal() -> bool;
#[must_use]
fn cxx_has_operator_less_than() -> bool;
#[must_use]
fn cxx_has_operator_less_than_or_equal() -> bool;
#[must_use]
fn cxx_has_operator_greater_than() -> bool;
#[must_use]
fn cxx_has_operator_greater_than_or_equal() -> bool;
#[must_use]
fn cxx_is_partially_ordered() -> bool;
#[must_use]
fn cxx_is_totally_ordered() -> bool;
#[must_use]
fn cxx_is_hashable() -> bool;
#[must_use]
fn rust_should_impl_cxx_extern_type_trivial() -> bool;
#[must_use]
fn rust_should_impl_unpin() -> bool;
#[must_use]
fn rust_should_impl_send() -> bool;
#[must_use]
fn rust_should_impl_sync() -> bool;
#[must_use]
fn rust_should_impl_copy() -> bool;
#[must_use]
fn rust_should_impl_debug() -> bool;
#[must_use]
fn rust_should_impl_default() -> bool;
#[must_use]
fn rust_should_impl_display() -> bool;
#[must_use]
fn rust_should_impl_drop() -> bool;
#[must_use]
fn rust_should_impl_moveref_copy_new() -> bool;
#[must_use]
fn rust_should_impl_moveref_move_new() -> bool;
#[must_use]
fn rust_should_impl_eq() -> bool;
#[must_use]
fn rust_should_impl_partial_eq() -> bool;
#[must_use]
fn rust_should_impl_partial_ord() -> bool;
#[must_use]
fn rust_should_impl_ord() -> bool;
#[must_use]
fn rust_should_impl_hash() -> bool;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ fn emit_item_fn_process_artifact_infos<'a>(
}
});
syn::parse_quote! {
#[allow(clippy::missing_errors_doc)]
pub fn process_artifacts(out_dir: &::std::path::Path) -> ::cxx_auto::BoxResult<()> {
let auto_out_dir_root = &out_dir.join("src/auto");
#(#items)*
Expand Down

0 comments on commit 769d955

Please sign in to comment.