Skip to content

Commit

Permalink
fix: Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
GrayJack committed Nov 19, 2024
1 parent 818fb73 commit 94b5498
Show file tree
Hide file tree
Showing 16 changed files with 163 additions and 166 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ targets = [
]
all-features = false
features = ["amalgation", "nightly"]
rustdoc-args = ["--cfg", "_doc"]
rustdoc-args = ["--cfg", "docsrs"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
3 changes: 1 addition & 2 deletions janetrs_version/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ impl PartialEq<&str> for JanetVersion {
.map(|s| s.parse::<u32>())
.take(3)
.zip([self.major, self.minor, self.patch].iter())
.map(|(o, s)| o.unwrap_or(u32::MAX).eq(s))
.all(core::convert::identity)
.all(|(o, s)| o.unwrap_or(u32::MAX).eq(s))
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use core::alloc::{AllocError, Allocator};
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "sparc",
target_arch = "asmjs",
target_arch = "wasm32",
target_arch = "hexagon",
target_arch = "riscv32"
Expand Down Expand Up @@ -155,7 +154,7 @@ impl Scratch {
}

#[cfg(feature = "nightly")]
#[cfg_attr(_doc, doc(cfg(feature = "nightly")))]
#[cfg_attr(docsrs, doc(cfg(feature = "nightly")))]
unsafe impl Allocator for Scratch {
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
self.malloc(layout).ok_or(AllocError)
Expand Down
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Display for Error {
}

#[cfg(feature = "std")]
#[cfg_attr(_doc, doc(cfg(feature = "std")))]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl StdError for Error {}

/// Janet client that initialize the Janet runtime.
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//! ## Cargo Features
//!
//! - `std`: Enable some trait impl for types that only exist on the `std` and the Error
//! trait
//! trait
//! - `unicode`: Enable more methods for JanetString and JanetBuffer
//! - `inline-more`: More aggressive inlining
//! - `amalgation`: Link the Janet runtime to the package, enabling to use the client
Expand Down Expand Up @@ -56,7 +56,7 @@
//! - Marshalling mechanism
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "nightly", feature(allocator_api))]
#![cfg_attr(_doc, feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg))]

// Cause compilation error when both amalgation and system is set
#[cfg(all(feature = "amalgation", feature = "link-system"))]
Expand All @@ -77,7 +77,7 @@ pub mod lowlevel {

pub mod allocator;
#[cfg(any(feature = "amalgation", feature = "link-system"))]
#[cfg_attr(_doc, doc(cfg(any(feature = "amalgation", feature = "link-system"))))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "amalgation", feature = "link-system"))))]
pub mod client;
pub mod env;
mod gc;
Expand Down
12 changes: 6 additions & 6 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ macro_rules! count {
/// expressions. There are 2 forms of this macro:
/// * Create a [`JanetTuple`] containing a given list of elements
/// ```
/// use janetrs::{tuple, Janet};
/// use janetrs::{Janet, tuple};
/// # let _client = janetrs::client::JanetClient::init().unwrap();
///
/// let t = tuple![3, true, "hey"];
Expand Down Expand Up @@ -60,7 +60,7 @@ macro_rules! tuple {
/// expressions. There are 2 forms of this macro:
/// * Create a [`JanetArray`] containing a given list of elements
/// ```
/// use janetrs::{array, Janet};
/// use janetrs::{Janet, array};
/// # let _client = janetrs::client::JanetClient::init().unwrap();
///
/// let arr = array![3, true, "hey"];
Expand Down Expand Up @@ -115,7 +115,7 @@ macro_rules! array {
/// pairs as the items of the struct.
///
/// ```
/// use janetrs::{structs, Janet};
/// use janetrs::{Janet, structs};
/// # let _client = janetrs::client::JanetClient::init().unwrap();
///
/// let st = structs! {
Expand Down Expand Up @@ -151,7 +151,7 @@ macro_rules! structs {
/// pairs as the items of the struct.
///
/// ```
/// use janetrs::{table, Janet};
/// use janetrs::{Janet, table};
/// # let _client = janetrs::client::JanetClient::init().unwrap();
///
/// let table = table! {
Expand Down Expand Up @@ -302,7 +302,7 @@ macro_rules! jpanic {
/// # Examples
///
/// ```
/// use janetrs::{bad_slot, janet_fn, Janet, TaggedJanet};
/// use janetrs::{Janet, TaggedJanet, bad_slot, janet_fn};
///
/// #[janet_fn(arity(fix(1)))]
/// fn hi(args: &mut [Janet]) -> Janet {
Expand Down Expand Up @@ -385,7 +385,7 @@ macro_rules! jcatch {
///
/// [`catch_unwind`]: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
#[cfg(feature = "std")]
#[cfg_attr(_doc, doc(cfg(feature = "std")))]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
#[macro_export]
macro_rules! jtry {
($e:expr) => {{
Expand Down
12 changes: 6 additions & 6 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl JanetConversionError {
}

#[cfg(feature = "std")]
#[cfg_attr(_doc, doc(cfg(feature = "std")))]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl error::Error for JanetConversionError {}

impl Display for JanetConversionError {
Expand Down Expand Up @@ -760,7 +760,7 @@ impl Display for Janet {
}

#[cfg(feature = "std")]
#[cfg_attr(_doc, doc(cfg(feature = "std")))]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl error::Error for Janet {}

impl PartialEq<&Self> for Janet {
Expand Down Expand Up @@ -1724,7 +1724,7 @@ macro_rules! string_impl_partial_eq {
};
(#[cfg($attr:meta)]; $lhs:ty, $rhs:ty) => {
#[cfg($attr)]
#[cfg_attr(_doc, doc(cfg($attr)))]
#[cfg_attr(docsrs, doc(cfg($attr)))]
#[allow(clippy::extra_unused_lifetimes)]
impl<'a, 'b> PartialEq<$rhs> for $lhs {
#[inline]
Expand All @@ -1735,7 +1735,7 @@ macro_rules! string_impl_partial_eq {
}

#[cfg($attr)]
#[cfg_attr(_doc, doc(cfg($attr)))]
#[cfg_attr(docsrs, doc(cfg($attr)))]
#[allow(clippy::extra_unused_lifetimes)]
impl<'a, 'b> PartialEq<$lhs> for $rhs {
#[inline]
Expand Down Expand Up @@ -1774,7 +1774,7 @@ macro_rules! string_impl_partial_ord {
};
(#[cfg($attr:meta)]; $lhs:ty, $rhs:ty) => {
#[cfg($attr)]
#[cfg_attr(_doc, doc(cfg($attr)))]
#[cfg_attr(docsrs, doc(cfg($attr)))]
#[allow(clippy::extra_unused_lifetimes)]
impl<'a, 'b> PartialOrd<$rhs> for $lhs {
#[inline]
Expand All @@ -1785,7 +1785,7 @@ macro_rules! string_impl_partial_ord {
}

#[cfg($attr)]
#[cfg_attr(_doc, doc(cfg($attr)))]
#[cfg_attr(docsrs, doc(cfg($attr)))]
#[allow(clippy::extra_unused_lifetimes)]
impl<'a, 'b> PartialOrd<$lhs> for $rhs {
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/types/abstract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl fmt::Display for AbstractError {
}

#[cfg(feature = "std")]
#[cfg_attr(_doc, doc(cfg(feature = "std")))]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for AbstractError {}

/// Type that represents the Janet Abstract type.
Expand Down
Loading

0 comments on commit 94b5498

Please sign in to comment.