diff --git a/Cargo.toml b/Cargo.toml index 1669acff10..79f85e1bf7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/janetrs_version/src/lib.rs b/janetrs_version/src/lib.rs index b30d227fc7..1f32d32f28 100644 --- a/janetrs_version/src/lib.rs +++ b/janetrs_version/src/lib.rs @@ -147,8 +147,7 @@ impl PartialEq<&str> for JanetVersion { .map(|s| s.parse::()) .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)) } } } diff --git a/src/allocator.rs b/src/allocator.rs index a3a7a828fc..ed830c1979 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -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" @@ -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, AllocError> { self.malloc(layout).ok_or(AllocError) diff --git a/src/client.rs b/src/client.rs index 11c4dd72f8..a3ec8ca878 100644 --- a/src/client.rs +++ b/src/client.rs @@ -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. diff --git a/src/lib.rs b/src/lib.rs index faf15e5c79..3b4dbbe8f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 @@ -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"))] @@ -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; diff --git a/src/macros.rs b/src/macros.rs index 07e58aa7d0..36c1aa2170 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -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"]; @@ -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"]; @@ -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! { @@ -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! { @@ -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 { @@ -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) => {{ diff --git a/src/types.rs b/src/types.rs index 9af66b0860..3e87d3eecd 100644 --- a/src/types.rs +++ b/src/types.rs @@ -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 { @@ -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 { @@ -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] @@ -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] @@ -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] @@ -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] diff --git a/src/types/abstract.rs b/src/types/abstract.rs index 50802897e7..8269c8ec37 100644 --- a/src/types/abstract.rs +++ b/src/types/abstract.rs @@ -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. diff --git a/src/types/array.rs b/src/types/array.rs index 4805df5aa8..44a3f88d7a 100644 --- a/src/types/array.rs +++ b/src/types/array.rs @@ -443,7 +443,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, DeepEq, Janet, JanetArray}; + /// use janetrs::{DeepEq, Janet, JanetArray, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut array = array![1, 2, 3, 4]; @@ -694,7 +694,7 @@ impl<'data> JanetArray<'data> { /// /// # Examples /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut arr = array![1, "2", 3.0]; @@ -757,7 +757,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, assert_deep_eq, Janet}; + /// use janetrs::{Janet, array, assert_deep_eq}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut array = array![1, 2, 3, 4]; @@ -799,7 +799,7 @@ impl<'data> JanetArray<'data> { original_len: usize, } - impl<'a, 'data> Drop for BackshiftOnDrop<'a, 'data> { + impl Drop for BackshiftOnDrop<'_, '_> { fn drop(&mut self) { if self.deleted_cnt > 0 { // SAFETY: Trailing unchecked items must be valid since we never touch them. @@ -926,7 +926,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![10, 40, 30]; @@ -951,7 +951,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut x = array![0, 1, 2]; @@ -976,7 +976,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let x = array![0, 1, 2]; @@ -1002,7 +1002,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut x = array![0, 1, 2]; @@ -1028,7 +1028,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![10, 40, 30]; @@ -1053,7 +1053,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut x = array![0, 1, 2]; @@ -1078,7 +1078,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let x = array![0, 1, 2]; @@ -1104,7 +1104,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut x = array![0, 1, 2]; @@ -1138,7 +1138,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![1, 2, 3, 4, 5, 6]; @@ -1186,7 +1186,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![1, 0, 3, 0, 5, 6]; @@ -1225,7 +1225,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, assert_deep_eq, Janet}; + /// use janetrs::{Janet, array, assert_deep_eq}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array!["a", "b", "c", "d"]; @@ -1264,7 +1264,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, assert_deep_eq, Janet}; + /// use janetrs::{Janet, array, assert_deep_eq}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut arr = array!["a", "b", "c", "d"]; @@ -1293,7 +1293,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![1, 2, 3]; @@ -1316,7 +1316,7 @@ impl<'data> JanetArray<'data> { /// Basic usage: /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// assert_eq!( @@ -1328,7 +1328,7 @@ impl<'data> JanetArray<'data> { /// A panic upon overflow: /// /// ```should_panic - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// // this will panic at runtime @@ -1365,7 +1365,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![10, 40, 30]; @@ -1378,7 +1378,7 @@ impl<'data> JanetArray<'data> { /// Always returns `true` if `needle` is an empty slice: /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![10, 40, 30]; @@ -1397,7 +1397,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![10, 40, 30]; @@ -1410,7 +1410,7 @@ impl<'data> JanetArray<'data> { /// Always returns `true` if `needle` is an empty slice: /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![10, 40, 30]; @@ -1439,7 +1439,7 @@ impl<'data> JanetArray<'data> { /// found; the fourth could match any position in `[1, 4]`. /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let s = array![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; @@ -1458,7 +1458,7 @@ impl<'data> JanetArray<'data> { /// sort order: /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut s = array![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; @@ -1495,7 +1495,7 @@ impl<'data> JanetArray<'data> { /// found; the fourth could match any position in `[1, 4]`. /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let s = array![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; @@ -1538,7 +1538,7 @@ impl<'data> JanetArray<'data> { /// TODO: Find a good example /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// ``` #[inline] @@ -1558,7 +1558,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, DeepEq, Janet, TaggedJanet::Number}; + /// use janetrs::{DeepEq, Janet, TaggedJanet::Number, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// let mut arr = array![1, 2, 2, 3, 2]; /// @@ -1579,7 +1579,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, DeepEq, Janet, TaggedJanet::Number}; + /// use janetrs::{DeepEq, Janet, TaggedJanet::Number, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// let mut arr = array![10, 20, 21, 30, 20]; /// @@ -1614,7 +1614,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, DeepEq, Janet}; + /// use janetrs::{DeepEq, Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// let mut arr = array!["foo", "bar", "bar", "baz", "bar"]; /// @@ -1697,7 +1697,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![-5, 4, 1, -3, 2]; @@ -1741,7 +1741,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![5, 4, 1, 3, 2]; @@ -1786,7 +1786,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![-5i32, 4, 1, -3, 2]; @@ -1825,7 +1825,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![-5, 4, 1, -3, 2]; @@ -1867,7 +1867,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![5, 4, 1, 3, 2]; @@ -1911,7 +1911,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![-5i32, 4, 1, -3, 2]; @@ -1957,7 +1957,7 @@ impl<'data> JanetArray<'data> { /// Creates a iterator over the mutable reference of the array itens. /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut arr = array![1, 2, "janet"]; @@ -1989,7 +1989,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array!['r', 'u', 's', 't']; @@ -2003,7 +2003,7 @@ impl<'data> JanetArray<'data> { /// If the array is shorter than `size`: /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array!['f', 'o', 'o']; @@ -2032,7 +2032,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array!['l', 'o', 'r', 'e', 'm']; @@ -2068,7 +2068,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![0, 0, 0, 0, 0]; @@ -2111,7 +2111,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array!['l', 'o', 'r', 'e', 'm']; @@ -2151,7 +2151,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![0, 0, 0, 0, 0]; @@ -2190,7 +2190,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array!['l', 'o', 'r', 'e', 'm']; @@ -2226,7 +2226,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![0, 0, 0, 0, 0]; @@ -2269,7 +2269,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array!['l', 'o', 'r', 'e', 'm']; @@ -2310,7 +2310,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet}; + /// use janetrs::{Janet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![0, 0, 0, 0, 0]; @@ -2339,7 +2339,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array![10, 40, 33, 20]; @@ -2359,7 +2359,7 @@ impl<'data> JanetArray<'data> { /// iterator: /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array![10, 40, 33]; @@ -2377,7 +2377,7 @@ impl<'data> JanetArray<'data> { /// present between them: /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array![10, 6, 33, 20]; @@ -2405,7 +2405,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![10, 40, 30, 20, 60, 50]; @@ -2433,7 +2433,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let arr = array![11, 22, 33, 0, 44, 55]; @@ -2451,7 +2451,7 @@ impl<'data> JanetArray<'data> { /// slice will be the first (or last) item returned by the iterator. /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![0, 1, 1, 2, 3, 5, 8]; @@ -2480,7 +2480,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![100, 400, 300, 200, 600, 500]; @@ -2516,7 +2516,7 @@ impl<'data> JanetArray<'data> { /// `[20, 60, 50]`): /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![10, 40, 30, 20, 60, 50]; @@ -2546,7 +2546,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut v = array![10, 40, 30, 20, 60, 50]; @@ -2581,7 +2581,7 @@ impl<'data> JanetArray<'data> { /// by 3 (i.e., `[50]`, `[10, 40, 30, 20]`): /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let v = array![10, 40, 30, 20, 60, 50]; @@ -2612,7 +2612,7 @@ impl<'data> JanetArray<'data> { /// # Examples /// /// ``` - /// use janetrs::{array, Janet, TaggedJanet}; + /// use janetrs::{Janet, TaggedJanet, array}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut s = array![10, 40, 30, 20, 60, 50]; @@ -2648,7 +2648,7 @@ impl<'data> JanetArray<'data> { /// Using this method is equivalent to the following code: /// /// ``` - /// use janetrs::{array, assert_deep_eq, Janet}; + /// use janetrs::{Janet, array, assert_deep_eq}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// # let some_predicate = |x: &mut Janet| { /// # x.try_unwrap::() @@ -2679,7 +2679,7 @@ impl<'data> JanetArray<'data> { /// Splitting an array into evens and odds, reusing the original allocation: /// /// ``` - /// use janetrs::{array, assert_deep_eq, Janet, JanetArray}; + /// use janetrs::{Janet, JanetArray, array, assert_deep_eq}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut numbers = array![1, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15]; @@ -2750,7 +2750,7 @@ impl<'data> JanetArray<'data> { } // Private methods -impl<'data> JanetArray<'data> { +impl JanetArray<'_> { fn get_r(&self, range: Range) -> Option<&[Janet]> { if range.start < 0 || range.start > range.end || range.end > self.len() { None @@ -3144,7 +3144,7 @@ pub struct IterMut<'a, 'data> { index_tail: i32, } -impl<'a, 'data> Iterator for IterMut<'a, 'data> { +impl<'a> Iterator for IterMut<'a, '_> { type Item = &'a mut Janet; #[inline] @@ -3172,7 +3172,7 @@ impl Debug for IterMut<'_, '_> { } } -impl<'a, 'data> DoubleEndedIterator for IterMut<'a, 'data> { +impl DoubleEndedIterator for IterMut<'_, '_> { #[inline] fn next_back(&mut self) -> Option { if self.index_head == self.index_tail { @@ -3249,7 +3249,7 @@ impl FusedIterator for IntoIter<'_> {} /// # Example /// /// ``` -/// use janetrs::{array, array::ExtractIf, Janet}; +/// use janetrs::{Janet, array, array::ExtractIf}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut array = array![0, 1, 2]; diff --git a/src/types/buffer.rs b/src/types/buffer.rs index 6e6a87322e..8b87e4d154 100644 --- a/src/types/buffer.rs +++ b/src/types/buffer.rs @@ -529,7 +529,7 @@ impl JanetBuffer<'_> { /// assert_eq!(&b"foo\xFFbar\xE2\x98baz"[..], s.to_lowercase().as_bytes()); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] #[must_use = "this returns the lowercase string as a new JanetBuffer, without modifying the \ original"] @@ -595,7 +595,7 @@ impl JanetBuffer<'_> { /// assert_eq!(&b"foo\xFFbar\xE2\x98baz"[..], buf.as_bytes()); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn to_lowercase_into(&self, buf: &mut Self) { // based on bstr version of the same function @@ -745,7 +745,7 @@ impl JanetBuffer<'_> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] #[must_use = "this returns the uppercase string as a new JanetBuffer, without modifying the \ original"] @@ -811,7 +811,7 @@ impl JanetBuffer<'_> { /// assert_eq!(buf.as_bytes(), &b"FOO\xFFBAR\xE2\x98BAZ"[..]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn to_uppercase_into(&self, buf: &mut Self) { // based on bstr version of the same function @@ -929,7 +929,7 @@ impl JanetBuffer<'_> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] #[must_use = "this returns a trimmed string as a new JanetBuffer, without modifying the \ original"] @@ -957,7 +957,7 @@ impl JanetBuffer<'_> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] #[must_use = "this returns a trimmed string as a new JanetBuffer, without modifying the \ original"] @@ -985,7 +985,7 @@ impl JanetBuffer<'_> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] #[must_use = "this returns a trimmed string as a new JanetBuffer, without modifying the \ original"] @@ -1151,7 +1151,7 @@ impl JanetBuffer<'_> { /// an arbitrary sequence of 8-bit integers to an arbitrary sequence of /// 16-bit integers.) #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[inline] pub fn to_os_str(&self) -> Result<&OsStr, Utf8Error> { self.as_bytes().to_os_str() @@ -1167,7 +1167,7 @@ impl JanetBuffer<'_> { /// non-Unix systems such as Windows, where file paths are an arbitrary /// sequence of 16-bit integers. #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[inline] #[must_use = "this returns the result of the operation, without modifying the original"] pub fn to_os_str_lossy(&self) -> Cow { @@ -1183,7 +1183,7 @@ impl JanetBuffer<'_> { /// an arbitrary sequence of 8-bit integers to an arbitrary sequence of /// 16-bit integers.) #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[inline] pub fn to_path(&self) -> Result<&Path, Utf8Error> { self.as_bytes().to_path() @@ -1199,7 +1199,7 @@ impl JanetBuffer<'_> { /// non-Unix systems such as Windows, where file paths are an arbitrary /// sequence of 16-bit integers. #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[inline] #[must_use = "this returns the result of the operation, without modifying the original"] pub fn to_path_lossy(&self) -> Cow { @@ -1704,7 +1704,7 @@ impl JanetBuffer<'_> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn fields(&self) -> Fields { self.as_bytes().fields() @@ -1795,7 +1795,7 @@ impl JanetBuffer<'_> { /// ]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn grapheme_indices(&self) -> GraphemeIndices { self.as_bytes().grapheme_indices() @@ -1830,7 +1830,7 @@ impl JanetBuffer<'_> { /// assert_eq!(vec!["🇺🇸", "à̖"], graphemes); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn graphemes(&self) -> Graphemes { self.as_bytes().graphemes() @@ -1948,7 +1948,7 @@ impl JanetBuffer<'_> { /// ]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn sentence_indices(&self) -> SentenceIndices { self.as_bytes().sentence_indices() @@ -1981,7 +1981,7 @@ impl JanetBuffer<'_> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn sentences(&self) -> Sentences { self.as_bytes().sentences() @@ -2441,7 +2441,7 @@ impl JanetBuffer<'_> { /// /// [`words_with_break_indices`]: #method.words_with_break_indices #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn word_indices(&self) -> WordIndices { self.as_bytes().word_indices() @@ -2477,7 +2477,7 @@ impl JanetBuffer<'_> { /// ``` /// [`words_with_breaks`]: #method.words_with_breaks #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn words(&self) -> Words { self.as_bytes().words() @@ -2515,7 +2515,7 @@ impl JanetBuffer<'_> { /// ]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn words_with_break_indices(&self) -> WordsWithBreakIndices { self.as_bytes().words_with_break_indices() @@ -2546,7 +2546,7 @@ impl JanetBuffer<'_> { /// ]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn words_with_breaks(&self) -> WordsWithBreaks { self.as_bytes().words_with_breaks() diff --git a/src/types/fiber.rs b/src/types/fiber.rs index fdd40c4e80..6ee726668e 100644 --- a/src/types/fiber.rs +++ b/src/types/fiber.rs @@ -56,9 +56,8 @@ impl<'data> JanetFiber<'data> { pub fn with_env( env: JanetTable, capacity: i32, f: &mut JanetFunction, args: impl AsRef<[Janet]>, ) -> Option { - Self::new(capacity, f, args).map(|f| { + Self::new(capacity, f, args).inspect(|f| { unsafe { (*f.raw).env = env.raw }; - f }) } @@ -143,7 +142,7 @@ impl<'data> JanetFiber<'data> { /// /// # Examples /// ``` - /// use janetrs::{client::JanetClient, JanetFiber, JanetFunction}; + /// use janetrs::{JanetFiber, JanetFunction, client::JanetClient}; /// # fn main() -> Result<(), Box> { /// let _client = JanetClient::init_with_default_env()?; /// @@ -176,7 +175,7 @@ impl<'data> JanetFiber<'data> { /// /// # Examples /// ``` - /// use janetrs::{client::JanetClient, Janet, JanetFiber, JanetFunction}; + /// use janetrs::{Janet, JanetFiber, JanetFunction, client::JanetClient}; /// # fn main() -> Result<(), Box> { /// let _client = JanetClient::init_with_default_env()?; /// @@ -211,7 +210,7 @@ impl<'data> JanetFiber<'data> { /// /// # Examples /// ``` - /// use janetrs::{client::JanetClient, Janet, JanetFiber, JanetFunction}; + /// use janetrs::{Janet, JanetFiber, JanetFunction, client::JanetClient}; /// # fn main() -> Result<(), Box> { /// let _client = JanetClient::init_with_default_env()?; /// @@ -283,7 +282,7 @@ pub struct Exec<'a, 'data> { input: Janet, } -impl<'a, 'data> Iterator for Exec<'a, 'data> { +impl Iterator for Exec<'_, '_> { type Item = Janet; #[inline] diff --git a/src/types/function.rs b/src/types/function.rs index 9c98a75343..57ca24bcb0 100644 --- a/src/types/function.rs +++ b/src/types/function.rs @@ -106,7 +106,7 @@ impl<'data> CallError<'data> { /// Display the stacktrace in the given `output` #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[cfg_attr(feature = "inline-more", inline)] pub fn stacktrace(&mut self, output: &mut W) -> io::Result<()> { if let CallErrorKind::Run = self.kind { @@ -158,7 +158,7 @@ impl Display for CallError<'_> { } #[cfg(feature = "std")] -#[cfg_attr(_doc, doc(cfg(feature = "std")))] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl error::Error for CallError<'_> {} /// A representation of a Janet function defined at the Janet side. diff --git a/src/types/io.rs b/src/types/io.rs index 947c9d1e5b..cb75cb4d4c 100644 --- a/src/types/io.rs +++ b/src/types/io.rs @@ -21,7 +21,7 @@ pub struct JanetFile { impl JanetFile { /// Open an anonymous temporary file that is removed on close. #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] pub fn temp() -> io::Result { let file = unsafe { libc::tmpfile() as *mut evil_janet::FILE }; @@ -70,7 +70,7 @@ impl JanetFile { } #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] fn last_error(&self) -> Option { let errno = unsafe { libc::ferror(self.raw.file as _) }; @@ -86,7 +86,7 @@ impl JanetFile { } #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] fn position(&self) -> io::Result { let offset = unsafe { libc::ftell(self.raw.file as _) }; @@ -151,7 +151,7 @@ impl fmt::Write for JanetFile { } #[cfg(feature = "std")] -#[cfg_attr(_doc, doc(cfg(feature = "std")))] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl Read for JanetFile { fn read(&mut self, buf: &mut [u8]) -> io::Result { if buf.is_empty() { @@ -176,7 +176,7 @@ impl Read for JanetFile { } #[cfg(feature = "std")] -#[cfg_attr(_doc, doc(cfg(feature = "std")))] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl Write for JanetFile { fn write(&mut self, buf: &[u8]) -> io::Result { if buf.is_empty() { @@ -211,7 +211,7 @@ impl Write for JanetFile { } #[cfg(feature = "std")] -#[cfg_attr(_doc, doc(cfg(feature = "std")))] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl Seek for JanetFile { fn seek(&mut self, pos: SeekFrom) -> io::Result { // SAFETY: We check for the errors after the call @@ -237,7 +237,7 @@ impl Seek for JanetFile { } #[cfg(all(unix, feature = "std"))] -#[cfg_attr(_doc, doc(cfg(all(unix, feature = "std"))))] +#[cfg_attr(docsrs, doc(cfg(all(unix, feature = "std"))))] impl AsRawFd for JanetFile { #[inline] fn as_raw_fd(&self) -> RawFd { @@ -246,7 +246,7 @@ impl AsRawFd for JanetFile { } #[cfg(all(unix, feature = "std"))] -#[cfg_attr(_doc, doc(cfg(all(unix, feature = "std"))))] +#[cfg_attr(docsrs, doc(cfg(all(unix, feature = "std"))))] impl IntoRawFd for JanetFile { #[inline] fn into_raw_fd(self) -> RawFd { @@ -255,7 +255,7 @@ impl IntoRawFd for JanetFile { } #[cfg(all(windows, feature = "std"))] -#[cfg_attr(_doc, doc(cfg(all(windows, feature = "std"))))] +#[cfg_attr(docsrs, doc(cfg(all(windows, feature = "std"))))] impl AsRawHandle for JanetFile { #[inline] fn as_raw_handle(&self) -> RawHandle { @@ -268,7 +268,7 @@ impl AsRawHandle for JanetFile { } #[cfg(all(windows, feature = "std"))] -#[cfg_attr(_doc, doc(cfg(all(windows, feature = "std"))))] +#[cfg_attr(docsrs, doc(cfg(all(windows, feature = "std"))))] impl IntoRawHandle for JanetFile { #[inline] fn into_raw_handle(self) -> RawHandle { diff --git a/src/types/string.rs b/src/types/string.rs index 6653509019..78d976f372 100644 --- a/src/types/string.rs +++ b/src/types/string.rs @@ -377,7 +377,7 @@ impl<'data> JanetString<'data> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[allow(clippy::return_self_not_must_use)] #[inline] pub fn to_lowercase(&self) -> Self { @@ -445,7 +445,7 @@ impl<'data> JanetString<'data> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn to_lowercase_into(&self, buf: &mut JanetBuffer) { buf.reserve(self.len()); @@ -552,7 +552,7 @@ impl<'data> JanetString<'data> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] #[allow(clippy::return_self_not_must_use)] pub fn to_uppercase(&self) -> Self { @@ -617,7 +617,7 @@ impl<'data> JanetString<'data> { /// assert_eq!(buf.as_bytes(), &b"FOO\xFFBAR\xE2\x98BAZ"[..]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn to_uppercase_into(&self, buf: &mut JanetBuffer) { // based on bstr version of the same function @@ -691,7 +691,7 @@ impl<'data> JanetString<'data> { /// assert_eq!(s.trim(), JanetString::new("foo\tbar")); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[allow(clippy::return_self_not_must_use)] #[inline] pub fn trim(&self) -> Self { @@ -715,7 +715,7 @@ impl<'data> JanetString<'data> { /// assert_eq!(s.trim_start(), JanetString::new("foo\tbar\t\u{2003}\n")); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[allow(clippy::return_self_not_must_use)] #[inline] pub fn trim_start(&self) -> Self { @@ -739,7 +739,7 @@ impl<'data> JanetString<'data> { /// assert_eq!(s.trim_end(), JanetString::new(" foo\tbar")); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[allow(clippy::return_self_not_must_use)] #[inline] pub fn trim_end(&self) -> Self { @@ -898,7 +898,7 @@ impl<'data> JanetString<'data> { /// an arbitrary sequence of 8-bit integers to an arbitrary sequence of /// 16-bit integers.) #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[inline] pub fn to_os_str(&self) -> Result<&OsStr, Utf8Error> { self.as_bytes().to_os_str() @@ -914,7 +914,7 @@ impl<'data> JanetString<'data> { /// non-Unix systems such as Windows, where file paths are an arbitrary /// sequence of 16-bit integers. #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[inline] pub fn to_os_str_lossy(&self) -> Cow { self.as_bytes().to_os_str_lossy() @@ -929,7 +929,7 @@ impl<'data> JanetString<'data> { /// an arbitrary sequence of 8-bit integers to an arbitrary sequence of /// 16-bit integers.) #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[inline] pub fn to_path(&self) -> Result<&Path, Utf8Error> { self.as_bytes().to_path() @@ -945,7 +945,7 @@ impl<'data> JanetString<'data> { /// non-Unix systems such as Windows, where file paths are an arbitrary /// sequence of 16-bit integers. #[cfg(feature = "std")] - #[cfg_attr(_doc, doc(cfg(feature = "std")))] + #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[inline] pub fn to_path_lossy(&self) -> Cow { self.as_bytes().to_path_lossy() @@ -1449,7 +1449,7 @@ impl<'data> JanetString<'data> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn fields(&self) -> Fields { self.as_bytes().fields() @@ -1519,7 +1519,7 @@ impl<'data> JanetString<'data> { /// assert_eq!(vec![(0, 5, "à̖"), (5, 13, "🇺🇸")], graphemes); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn grapheme_indices(&self) -> GraphemeIndices { self.as_bytes().grapheme_indices() @@ -1554,7 +1554,7 @@ impl<'data> JanetString<'data> { /// assert_eq!(vec!["🇺🇸", "à̖"], graphemes); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn graphemes(&self) -> Graphemes { self.as_bytes().graphemes() @@ -1672,7 +1672,7 @@ impl<'data> JanetString<'data> { /// ]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn sentence_indices(&self) -> SentenceIndices { self.as_bytes().sentence_indices() @@ -1705,7 +1705,7 @@ impl<'data> JanetString<'data> { /// ); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn sentences(&self) -> Sentences { self.as_bytes().sentences() @@ -2165,7 +2165,7 @@ impl<'data> JanetString<'data> { /// /// [`words_with_break_indices`]: #method.words_with_break_indices #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn word_indices(&self) -> WordIndices { self.as_bytes().word_indices() @@ -2201,7 +2201,7 @@ impl<'data> JanetString<'data> { /// ``` /// [`words_with_breaks`]: #method.words_with_breaks #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn words(&self) -> Words { self.as_bytes().words() @@ -2239,7 +2239,7 @@ impl<'data> JanetString<'data> { /// ]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn words_with_break_indices(&self) -> WordsWithBreakIndices { self.as_bytes().words_with_break_indices() @@ -2270,7 +2270,7 @@ impl<'data> JanetString<'data> { /// ]); /// ``` #[cfg(feature = "unicode")] - #[cfg_attr(_doc, doc(cfg(feature = "unicode")))] + #[cfg_attr(docsrs, doc(cfg(feature = "unicode")))] #[inline] pub fn words_with_breaks(&self) -> WordsWithBreaks { self.as_bytes().words_with_breaks() diff --git a/src/types/structs.rs b/src/types/structs.rs index 77d5350ea7..e948308297 100644 --- a/src/types/structs.rs +++ b/src/types/structs.rs @@ -339,7 +339,7 @@ impl<'data> JanetStruct<'data> { /// /// # Examples /// ``` - /// use janetrs::{structs, Janet}; + /// use janetrs::{Janet, structs}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let st = structs! {10 => "ten"}; @@ -356,7 +356,7 @@ impl<'data> JanetStruct<'data> { /// /// # Examples /// ``` - /// use janetrs::{structs, Janet}; + /// use janetrs::{Janet, structs}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let st = structs! {10 => "ten"}; @@ -662,7 +662,7 @@ impl Debug for Iter<'_, '_> { } } -impl<'a, 'data> Iterator for Iter<'a, 'data> { +impl<'a> Iterator for Iter<'a, '_> { type Item = (&'a Janet, &'a Janet); #[inline] diff --git a/src/types/table.rs b/src/types/table.rs index 24557a35f0..9c8d7666bc 100644 --- a/src/types/table.rs +++ b/src/types/table.rs @@ -268,7 +268,7 @@ impl<'data> JanetTable<'data> { /// /// /// ``` - /// use janetrs::{table, Janet, JanetTable}; + /// use janetrs::{Janet, JanetTable, table}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut table = table! {1 => "a", 2 => "b"}; @@ -499,7 +499,7 @@ impl<'data> JanetTable<'data> { /// /// # Examples /// ``` - /// use janetrs::{table, Janet, JanetTable}; + /// use janetrs::{Janet, JanetTable, table}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut table = table! {1 => "a", 2 => "b"}; @@ -520,7 +520,7 @@ impl<'data> JanetTable<'data> { /// /// # Examples /// ``` - /// use janetrs::{table, Janet, JanetTable}; + /// use janetrs::{Janet, JanetTable, table}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut table = table! {1 => "a", 2 => "b"}; @@ -541,7 +541,7 @@ impl<'data> JanetTable<'data> { /// /// # Examples /// ``` - /// use janetrs::{table, Janet, JanetTable}; + /// use janetrs::{Janet, JanetTable, table}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut table = table! {1 => "a", 2 => "b"}; @@ -645,7 +645,7 @@ impl<'data> JanetTable<'data> { /// /// # Examples /// ``` - /// use janetrs::{table, Janet, JanetTable}; + /// use janetrs::{Janet, JanetTable, table}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut table = table! {1 => "a", 2 => "b"}; @@ -1079,7 +1079,7 @@ impl<'data> JanetTable<'data> { /// /// # Examples /// ``` - /// use janetrs::{table, Janet}; + /// use janetrs::{Janet, table}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut table = table! { 1 => "10", true => 10.0}; @@ -1124,7 +1124,7 @@ impl<'data> JanetTable<'data> { /// /// # Examples /// ``` - /// use janetrs::{table, Janet}; + /// use janetrs::{Janet, table}; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// /// let mut table = table! { 1 => "10", true => 10.0}; @@ -1574,14 +1574,14 @@ pub struct OccupiedEntry<'a, 'data> { table: &'a mut JanetTable<'data>, } -impl<'a, 'data> OccupiedEntry<'a, 'data> { +impl<'a> OccupiedEntry<'a, '_> { /// Gets a reference to the value in the entry. /// /// # Examples /// ``` /// use janetrs::{ - /// table::{Entry, JanetTable}, /// Janet, + /// table::{Entry, JanetTable}, /// }; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// @@ -1608,8 +1608,8 @@ impl<'a, 'data> OccupiedEntry<'a, 'data> { /// # Examples /// ``` /// use janetrs::{ - /// table::{Entry, JanetTable}, /// Janet, + /// table::{Entry, JanetTable}, /// }; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// @@ -1644,8 +1644,8 @@ impl<'a, 'data> OccupiedEntry<'a, 'data> { /// # Examples /// ``` /// use janetrs::{ - /// table::{Entry, JanetTable}, /// Janet, + /// table::{Entry, JanetTable}, /// }; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// @@ -1674,8 +1674,8 @@ impl<'a, 'data> OccupiedEntry<'a, 'data> { /// # Examples /// ``` /// use janetrs::{ - /// table::{Entry, JanetTable}, /// Janet, + /// table::{Entry, JanetTable}, /// }; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// @@ -1707,8 +1707,8 @@ impl<'a, 'data> OccupiedEntry<'a, 'data> { /// # Examples /// ``` /// use janetrs::{ - /// table::{Entry, JanetTable}, /// Janet, + /// table::{Entry, JanetTable}, /// }; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// @@ -1773,8 +1773,8 @@ impl<'a, 'data> VacantEntry<'a, 'data> { /// # Examples /// ``` /// use janetrs::{ - /// table::{Entry, JanetTable}, /// Janet, + /// table::{Entry, JanetTable}, /// }; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// @@ -1833,8 +1833,8 @@ impl<'a, 'data> VacantEntry<'a, 'data> { /// # Examples /// ``` /// use janetrs::{ - /// table::{Entry, JanetTable}, /// Janet, + /// table::{Entry, JanetTable}, /// }; /// # let _client = janetrs::client::JanetClient::init().unwrap(); /// @@ -1883,7 +1883,7 @@ impl Debug for OccupiedError<'_, '_> { } } -impl<'a, 'data> fmt::Display for OccupiedError<'a, 'data> { +impl fmt::Display for OccupiedError<'_, '_> { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_fmt(format_args!( @@ -1896,7 +1896,7 @@ impl<'a, 'data> fmt::Display for OccupiedError<'a, 'data> { } #[cfg(feature = "std")] -#[cfg_attr(_doc, doc(cfg(feature = "std")))] +#[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl std::error::Error for OccupiedError<'_, '_> {} /// An iterator over a reference to the [`JanetTable`] key-value pairs. @@ -1915,7 +1915,7 @@ impl Debug for Iter<'_, '_> { } } -impl<'a, 'data> Iterator for Iter<'a, 'data> { +impl<'a> Iterator for Iter<'a, '_> { type Item = (&'a Janet, &'a Janet); #[inline] @@ -2164,7 +2164,7 @@ impl FusedIterator for IntoIter<'_> {} #[cfg(all(test, any(feature = "amalgation", feature = "link-system")))] mod tests { use super::*; - use crate::{client::JanetClient, table, JanetString}; + use crate::{JanetString, client::JanetClient, table}; #[test] fn index() -> Result<(), crate::client::Error> {