Skip to content
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
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ discord_url = "https://discord.gg/m3YfbXpUUY"
# Source :: https://github.com/obox-systems/conventions/blob/master/code_style.md#lints-and-warnings

# Denies non-idiomatic code for Rust 2018 edition.
rust_2018_idioms = "deny"
rust_2018_idioms = { level = "deny", priority = -1 }
# Denies using features that may break in future Rust versions.
future_incompatible = "deny"
future_incompatible = { level = "deny", priority = -1 }
# Warns if public items lack documentation.
missing_docs = "warn"
# Warns for public types not implementing Debug.
Expand All @@ -41,9 +41,9 @@ unsafe-code = "warn"

[workspace.lints.clippy]
# Denies restrictive lints, limiting certain language features/patterns.
restriction = "warn"
#restriction = { level = "deny", priority = -1 }
# Denies pedantic lints, enforcing strict coding styles and conventions.
pedantic = "warn"
pedantic = { level = "warn", priority = -1 }
# Denies undocumented unsafe blocks.
undocumented_unsafe_blocks = "deny"
# xxx : check
Expand Down
2 changes: 1 addition & 1 deletion module/core/clone_dyn_types/Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- {{# generate.module_header{} #}} -->
# Module :: clone_dyn_types
# Module :: `clone_dyn_types`
<!--{ generate.module_header.start() }-->
[![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/module_clone_dyn_push.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/module_clone_dyn_push.yml) [![docs.rs](https://img.shields.io/docsrs/clone_dyn_types?color=e3e8f0&logo=docs.rs)](https://docs.rs/clone_dyn_types) [![Open in Gitpod](https://raster.shields.io/static/v1?label=try&message=online&color=eee&logo=gitpod&logoColor=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fclone_dyn%2Fexamples%2Fclone_dyn_trivial.rs,RUN_POSTFIX=--example%20clone_dyn_trivial/https://github.com/Wandalen/wTools) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY)
<!--{ generate.module_header.end }-->
Expand Down
24 changes: 16 additions & 8 deletions module/core/clone_dyn_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ mod private
T : Clone,
{
#[ inline ]
#[ allow( clippy::implicit_return, clippy::as_conversions, clippy::ptr_as_ptr ) ]
fn __clone_dyn( &self, _ : DontCallMe ) -> *mut ()
{
Box::< T >::into_raw( Box::new( self.clone() ) ) as *mut ()
Expand All @@ -51,6 +52,7 @@ mod private
T : Clone,
{
#[ inline ]
#[ allow( clippy::implicit_return, clippy::as_conversions, clippy::ptr_as_ptr ) ]
fn __clone_dyn( &self, _ : DontCallMe ) -> *mut ()
{
Box::< [ T ] >::into_raw( self.iter().cloned().collect() ) as *mut ()
Expand All @@ -61,14 +63,15 @@ mod private
impl CloneDyn for str
{
#[ inline ]
#[ allow( clippy::as_conversions, clippy::ptr_as_ptr, clippy::implicit_return ) ]
fn __clone_dyn( &self, _ : DontCallMe ) -> *mut ()
{
Box::< str >::into_raw( Box::from( self ) ) as *mut ()
}
}

///
/// True clone which is applicable not only to clonable entities, but to trait objects implementing CloneDyn.
/// True clone which is applicable not only to clonable entities, but to trait objects implementing `CloneDyn`.
///
/// # Example
///
Expand Down Expand Up @@ -100,7 +103,7 @@ mod private
// that the `CloneDyn` trait is correctly implemented for the given type `T`, ensuring that `__clone_dyn` returns a
// valid pointer to a cloned instance of `T`.
//
#[ allow( unsafe_code ) ]
#[ allow( unsafe_code, clippy::as_conversions, clippy::ptr_as_ptr, clippy::implicit_return, clippy::undocumented_unsafe_blocks ) ]
unsafe
{
*Box::from_raw( < T as CloneDyn >::__clone_dyn( src, DontCallMe ) as *mut T )
Expand Down Expand Up @@ -185,7 +188,7 @@ mod private
// The safety of this function relies on the correct implementation of the `CloneDyn` trait for the given type `T`.
// Specifically, `__clone_dyn` must return a valid pointer to a cloned instance of `T`.
//
#[ allow( unsafe_code ) ]
#[ allow( unsafe_code, clippy::implicit_return, clippy::as_conversions, clippy::ptr_cast_constness, clippy::ptr_as_ptr, clippy::multiple_unsafe_ops_per_block, clippy::undocumented_unsafe_blocks, clippy::ref_as_ptr ) ]
unsafe
{
let mut ptr = ref_dyn as *const T;
Expand All @@ -207,22 +210,24 @@ mod private
impl< T : Clone > Sealed for [ T ] {}
impl Sealed for str {}
}
use sealed::*;
use sealed::{ DontCallMe, Sealed };

}

#[ cfg( feature = "enabled" ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ allow( clippy::pub_use ) ]
pub use own::*;

/// Own namespace of the module.
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod own
{
use super::*;
use super::orphan;
#[ doc( inline ) ]
#[ allow( clippy::useless_attribute, clippy::pub_use ) ]
pub use orphan::*;
}

Expand All @@ -231,8 +236,9 @@ pub mod own
#[ allow( unused_imports ) ]
pub mod orphan
{
use super::*;
use super::exposed;
#[ doc( inline ) ]
#[ allow( clippy::useless_attribute, clippy::pub_use ) ]
pub use exposed::*;
}

Expand All @@ -241,8 +247,9 @@ pub mod orphan
#[ allow( unused_imports ) ]
pub mod exposed
{
use super::*;
use super::prelude;
#[ doc( inline ) ]
#[ allow( clippy::useless_attribute, clippy::pub_use ) ]
pub use prelude::*;
}

Expand All @@ -251,8 +258,9 @@ pub mod exposed
#[ allow( unused_imports ) ]
pub mod prelude
{
use super::*;
use super::private;
#[ doc( inline ) ]
#[ allow( clippy::useless_attribute, clippy::pub_use ) ]
pub use private::
{
CloneDyn,
Expand Down
2 changes: 1 addition & 1 deletion module/core/collection_tools/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- {{# generate.module_header{} #}} -->

# Module :: collection_tools
# Module :: `collection_tools`
<!--{ generate.module_header.start() }-->
[![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/module_collection_tools_push.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/module_collection_tools_push.yml) [![docs.rs](https://img.shields.io/docsrs/collection_tools?color=e3e8f0&logo=docs.rs)](https://docs.rs/collection_tools) [![Open in Gitpod](https://raster.shields.io/static/v1?label=try&message=online&color=eee&logo=gitpod&logoColor=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fcollection_tools%2Fexamples%2Fcollection_tools_trivial.rs,RUN_POSTFIX=--example%20collection_tools_trivial/https://github.com/Wandalen/wTools) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY)
<!--{ generate.module_header.end }-->
Expand Down
11 changes: 6 additions & 5 deletions module/core/collection_tools/src/collection/binary_heap.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[ allow( unused_imports ) ]
#[ allow( unused_imports, clippy::wildcard_imports ) ]
use super::*;

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ allow( clippy::pub_use ) ]
pub use alloc::collections::binary_heap::*;

/// Creates a `BinaryHeap` from a list of elements.
Expand Down Expand Up @@ -32,8 +33,8 @@ pub use alloc::collections::binary_heap::*;
/// # Parameters
///
/// - `$( $key:expr ),* $( , )?`: A comma-separated list of elements to insert into the `BinaryHeap`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `BinaryHeap`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `BinaryHeap`.
///
/// # Returns
///
Expand Down Expand Up @@ -101,8 +102,8 @@ macro_rules! heap
/// # Parameters
///
/// - `$( $key:expr ),* $( , )?`: A comma-separated list of elements to insert into the `BinaryHeap`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `BinaryHeap`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `BinaryHeap`.
///
/// # Returns
///
Expand Down
11 changes: 6 additions & 5 deletions module/core/collection_tools/src/collection/btree_map.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[ allow( unused_imports ) ]
#[ allow( unused_imports, clippy::wildcard_imports ) ]
use super::*;

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ allow( clippy::pub_use ) ]
pub use alloc::collections::btree_map::*;

/// Creates a `BTreeMap` from a list of key-value pairs.
Expand Down Expand Up @@ -32,8 +33,8 @@ pub use alloc::collections::btree_map::*;
/// # Parameters
///
/// - `$( $key:expr => $value:expr ),* $( , )?`: A comma-separated list of key-value pairs to insert into the `BTreeMap`.
/// Each key and value can be of any type that implements the `Into< K >` and `Into< V >` traits, where `K` and `V` are the
/// types stored in the `BTreeMap` as keys and values, respectively.
/// Each key and value can be of any type that implements the `Into< K >` and `Into< V >` traits, where `K` and `V` are the
/// types stored in the `BTreeMap` as keys and values, respectively.
///
/// # Returns
///
Expand Down Expand Up @@ -114,8 +115,8 @@ macro_rules! bmap
/// # Parameters
///
/// - `$( $key:expr => $value:expr ),* $( , )?`: A comma-separated list of key-value pairs to insert into the `BTreeMap`.
/// Each key and value can be of any type that implements the `Into< K >` and `Into< V >` traits, where `K` and `V` are the
/// types stored in the `BTreeMap` as keys and values, respectively.
/// Each key and value can be of any type that implements the `Into< K >` and `Into< V >` traits, where `K` and `V` are the
/// types stored in the `BTreeMap` as keys and values, respectively.
///
/// # Returns
///
Expand Down
11 changes: 6 additions & 5 deletions module/core/collection_tools/src/collection/btree_set.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[ allow( unused_imports ) ]
#[ allow( unused_imports, clippy::wildcard_imports ) ]
use super::*;

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ allow( clippy::pub_use ) ]
pub use alloc::collections::btree_set::*;

/// Creates a `BTreeSet` from a list of elements.
Expand All @@ -29,8 +30,8 @@ pub use alloc::collections::btree_set::*;
/// # Parameters
///
/// - `$( $key:expr ),* $( , )?`: A comma-separated list of elements to insert into the `BTreeSet`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `BTreeSet`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `BTreeSet`.
///
/// # Returns
///
Expand Down Expand Up @@ -100,8 +101,8 @@ macro_rules! bset
/// # Parameters
///
/// - `$( $key:expr ),* $( , )?`: A comma-separated list of elements to insert into the `BTreeSet`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `BTreeSet`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `BTreeSet`.
///
/// # Returns
///
Expand Down
9 changes: 5 additions & 4 deletions module/core/collection_tools/src/collection/hash_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub use crate::dependency::hashbrown::hash_map::*;
#[ cfg( not( feature = "no_std" ) ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ allow( clippy::pub_use ) ]
pub use std::collections::hash_map::*;

/// Creates a `HashMap` from a list of key-value pairs.
Expand Down Expand Up @@ -41,8 +42,8 @@ pub use std::collections::hash_map::*;
/// # Parameters
///
/// - `$( $key:expr => $value:expr ),* $( , )?`: A comma-separated list of key-value pairs to insert into the `HashMap`.
/// Each key and value can be of any type that implements the `Into<K>` and `Into<V>` traits, where `K` and `V` are the
/// types stored in the `HashMap` as keys and values, respectively.
/// Each key and value can be of any type that implements the `Into<K>` and `Into<V>` traits, where `K` and `V` are the
/// types stored in the `HashMap` as keys and values, respectively.
///
/// # Returns
///
Expand Down Expand Up @@ -125,8 +126,8 @@ macro_rules! hmap
/// # Parameters
///
/// - `$( $key:expr => $value:expr ),* $( , )?`: A comma-separated list of key-value pairs to insert into the `HashMap`.
/// Each key and value can be of any type that implements the `Into<K>` and `Into<V>` traits, where `K` and `V` are the
/// types stored in the `HashMap` as keys and values, respectively.
/// Each key and value can be of any type that implements the `Into<K>` and `Into<V>` traits, where `K` and `V` are the
/// types stored in the `HashMap` as keys and values, respectively.
///
/// # Returns
///
Expand Down
9 changes: 5 additions & 4 deletions module/core/collection_tools/src/collection/hash_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub use crate::dependency::hashbrown::hash_set::*;
#[ cfg( not( feature = "no_std" ) ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ allow( clippy::pub_use ) ]
pub use std::collections::hash_set::*;

/// Creates a `HashSet` from a list of elements.
Expand Down Expand Up @@ -40,8 +41,8 @@ pub use std::collections::hash_set::*;
/// # Parameters
///
/// - `$( $key:expr ),* $( , )?`: A comma-separated list of elements to insert into the `HashSet`.
/// Each element can be of any type that implements the `Into< T >` trait, where `T` is the
/// type stored in the `HashSet`.
/// Each element can be of any type that implements the `Into< T >` trait, where `T` is the
/// type stored in the `HashSet`.
///
/// # Returns
///
Expand Down Expand Up @@ -124,8 +125,8 @@ macro_rules! hset
/// # Parameters
///
/// - `$( $key:expr ),* $( , )?`: A comma-separated list of elements to insert into the `HashSet`.
/// Each element can be of any type that implements the `Into< T >` trait, where `T` is the
/// type stored in the `HashSet`.
/// Each element can be of any type that implements the `Into< T >` trait, where `T` is the
/// type stored in the `HashSet`.
///
/// # Returns
///
Expand Down
11 changes: 6 additions & 5 deletions module/core/collection_tools/src/collection/linked_list.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[ allow( unused_imports ) ]
#[ allow( unused_imports, clippy::wildcard_imports ) ]
use super::*;

#[ doc( inline ) ]
#[ allow( unused_imports ) ]
#[ allow( clippy::pub_use ) ]
pub use alloc::collections::linked_list::*;

/// Creates a `LinkedList` from a llist of elements.
Expand Down Expand Up @@ -32,8 +33,8 @@ pub use alloc::collections::linked_list::*;
/// # Parameters
///
/// - `$( $key:expr ),* $( , )?`: A comma-separated llist of elements to insert into the `LinkedList`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `LinkedList`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `LinkedList`.
///
/// # Returns
///
Expand Down Expand Up @@ -114,8 +115,8 @@ macro_rules! llist
/// # Parameters
///
/// - `$( $key:expr ),* $( , )?`: A comma-separated llist of elements to insert into the `LinkedList`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `LinkedList`.
/// Each element can be of any type that implements the `Into<T>` trait, where `T` is the
/// type stored in the `LinkedList`.
///
/// # Returns
///
Expand Down
Loading
Loading