mirror of
git://git.proxmox.com/git/perlmod.git
synced 2025-03-12 00:58:16 +03:00
clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
5e2a30e18c
commit
1adcd9727e
@ -116,7 +116,7 @@ pub fn handle_function(
|
|||||||
let pat_ty = match arg {
|
let pat_ty = match arg {
|
||||||
syn::FnArg::Receiver(_) => bail!(arg => "cannot export self-taking methods as xsubs"),
|
syn::FnArg::Receiver(_) => bail!(arg => "cannot export self-taking methods as xsubs"),
|
||||||
syn::FnArg::Typed(ref mut pt) => {
|
syn::FnArg::Typed(ref mut pt) => {
|
||||||
pt.attrs.retain(|attr| !argument_attrs.handle_attr(&attr));
|
pt.attrs.retain(|attr| !argument_attrs.handle_attr(attr));
|
||||||
argument_attrs.validate(pt.span())?;
|
argument_attrs.validate(pt.span())?;
|
||||||
&*pt
|
&*pt
|
||||||
}
|
}
|
||||||
@ -328,6 +328,7 @@ struct ReturnHandling {
|
|||||||
wrapper_func: TokenStream,
|
wrapper_func: TokenStream,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn handle_return_kind(
|
fn handle_return_kind(
|
||||||
attr: &FunctionAttrs,
|
attr: &FunctionAttrs,
|
||||||
ret: Return,
|
ret: Return,
|
||||||
|
@ -128,7 +128,9 @@ fn handle_error(result: Result<TokenStream, Error>) -> TokenStream {
|
|||||||
data
|
data
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_local!(static NON_FATAL_ERRORS: RefCell<Option<TokenStream>> = RefCell::new(None));
|
thread_local! {
|
||||||
|
static NON_FATAL_ERRORS: RefCell<Option<TokenStream>> = const { RefCell::new(None) };
|
||||||
|
}
|
||||||
|
|
||||||
/// The local error TLS must be freed at the end of a macro as any leftover `TokenStream` (even an
|
/// The local error TLS must be freed at the end of a macro as any leftover `TokenStream` (even an
|
||||||
/// empty one) will just panic between different runs as the multiple source files are handled by
|
/// empty one) will just panic between different runs as the multiple source files are handled by
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
/// been stabilized then.
|
/// been stabilized then.
|
||||||
mod pkg142;
|
mod pkg142;
|
||||||
|
|
||||||
|
/*
|
||||||
#[cfg(feature = "rustmuchlater")]
|
#[cfg(feature = "rustmuchlater")]
|
||||||
/// The following is what we ideally want to reach with future rust versions. It is technically
|
/// The following is what we ideally want to reach with future rust versions. It is technically
|
||||||
/// possible on nightly with #![feature(custom_inner_attributes)]
|
/// possible on nightly with #![feature(custom_inner_attributes)]
|
||||||
mod pkginline;
|
mod pkginline;
|
||||||
|
*/
|
||||||
|
|
||||||
/// A test for blessed values.
|
/// A test for blessed values.
|
||||||
mod bless;
|
mod bless;
|
||||||
|
@ -22,7 +22,7 @@ fn main() {
|
|||||||
Command::new("perl")
|
Command::new("perl")
|
||||||
.arg("-MDevel::PPPort")
|
.arg("-MDevel::PPPort")
|
||||||
.arg("-e")
|
.arg("-e")
|
||||||
.arg(&format!(
|
.arg(format!(
|
||||||
r#"Devel::PPPort::WriteFile("{ppport_h_file_string_inner}");"#
|
r#"Devel::PPPort::WriteFile("{ppport_h_file_string_inner}");"#
|
||||||
))
|
))
|
||||||
.output()
|
.output()
|
||||||
|
@ -88,7 +88,7 @@ impl fmt::Display for MagicError {
|
|||||||
impl std::error::Error for MagicError {}
|
impl std::error::Error for MagicError {}
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static ERRNO: Cell<c_int> = Cell::new(0);
|
static ERRNO: Cell<c_int> = const { Cell::new(0) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the perlmod-specific `errno` value. This is *not* libc's `errno`, but a separate storage
|
/// Set the perlmod-specific `errno` value. This is *not* libc's `errno`, but a separate storage
|
||||||
@ -108,6 +108,11 @@ pub fn get_errno() -> c_int {
|
|||||||
/// This is part of the proc-macro API and is of little use to users of this crate directly.
|
/// This is part of the proc-macro API and is of little use to users of this crate directly.
|
||||||
/// When manually implementing "xsubs" this can be used before returning as a shortcut to copying
|
/// When manually implementing "xsubs" this can be used before returning as a shortcut to copying
|
||||||
/// the perlmod errno value to libc.
|
/// the perlmod errno value to libc.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// This is generally safe, but care should be taken as this manipulates `errno` and any C call
|
||||||
|
/// might mess it up again.
|
||||||
pub unsafe fn copy_errno_to_libc() {
|
pub unsafe fn copy_errno_to_libc() {
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::__errno_location().write(get_errno());
|
libc::__errno_location().write(get_errno());
|
||||||
|
@ -111,7 +111,7 @@ impl Hash {
|
|||||||
unsafe {
|
unsafe {
|
||||||
ffi::RSPL_hv_store(
|
ffi::RSPL_hv_store(
|
||||||
self.hv(),
|
self.hv(),
|
||||||
key.as_ptr() as *const u8 as *const libc::c_char,
|
key.as_ptr() as *const libc::c_char,
|
||||||
key.len() as i32,
|
key.len() as i32,
|
||||||
value.into_raw(),
|
value.into_raw(),
|
||||||
);
|
);
|
||||||
|
@ -144,6 +144,7 @@ unsafe impl<T> Send for MagicTag<T> {}
|
|||||||
|
|
||||||
impl<T> MagicTag<T> {
|
impl<T> MagicTag<T> {
|
||||||
/// Create a new tag. See [`MagicSpec`] for its usage.
|
/// Create a new tag. See [`MagicSpec`] for its usage.
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self(ffi::MGVTBL::zero(), PhantomData)
|
Self(ffi::MGVTBL::zero(), PhantomData)
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ use crate::Value;
|
|||||||
pub(crate) const NAME: &str = "$__perlmod_private_RawValue";
|
pub(crate) const NAME: &str = "$__perlmod_private_RawValue";
|
||||||
pub(crate) const VALUE: &str = "$__perlmod_private_raw_value";
|
pub(crate) const VALUE: &str = "$__perlmod_private_raw_value";
|
||||||
|
|
||||||
thread_local!(static SERIALIZE_RAW: RefCell<bool> = RefCell::new(false));
|
thread_local!(static SERIALIZE_RAW: RefCell<bool> = const { RefCell::new(false) });
|
||||||
|
|
||||||
pub(crate) struct RawGuard(bool);
|
pub(crate) struct RawGuard(bool);
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ impl Value {
|
|||||||
/// The caller must ensure that it is safe to decrease the reference count later on, or use
|
/// The caller must ensure that it is safe to decrease the reference count later on, or use
|
||||||
/// `into_raw()` instead of letting the `Value` get dropped.
|
/// `into_raw()` instead of letting the `Value` get dropped.
|
||||||
pub unsafe fn from_raw_move(ptr: *mut SV) -> Self {
|
pub unsafe fn from_raw_move(ptr: *mut SV) -> Self {
|
||||||
Self::from_scalar(unsafe { Scalar::from_raw_move(ptr as *mut SV) })
|
Self::from_scalar(unsafe { Scalar::from_raw_move(ptr) })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new reference to an existing `SV` value. This will increase the value's reference
|
/// Create a new reference to an existing `SV` value. This will increase the value's reference
|
||||||
@ -235,7 +235,7 @@ impl Value {
|
|||||||
///
|
///
|
||||||
/// The caller may still need to decrease the reference count for the `ptr` source value.
|
/// The caller may still need to decrease the reference count for the `ptr` source value.
|
||||||
pub unsafe fn from_raw_ref(ptr: *mut SV) -> Self {
|
pub unsafe fn from_raw_ref(ptr: *mut SV) -> Self {
|
||||||
Self::from_scalar(unsafe { Scalar::from_raw_ref(ptr as *mut SV) })
|
Self::from_scalar(unsafe { Scalar::from_raw_ref(ptr) })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert a [`Scalar`] to a [`Value`].
|
/// Convert a [`Scalar`] to a [`Value`].
|
||||||
|
Loading…
x
Reference in New Issue
Block a user