fixed a few clippy lints and disabled others i disagree with

This commit is contained in:
ripytide
2022-12-02 02:53:57 +00:00
parent 8871d13617
commit 49320f71aa
6 changed files with 14 additions and 16 deletions
+2 -2
View File
@@ -111,9 +111,9 @@ Issue (or even open a new one) and I'd be happy to implement it.
To summarise:
- No coalescing insert functions, yet
- No coalescing/merge insert functions, yet
- No `gaps()` iterator function, yet
- Missing some functions common to BTreeMap and Set like:
- Missing some functions common to BTreeMap and BTreeSet like:
- `clear()`
- `is_subset()`
- etc... a bunch more
+1 -1
View File
@@ -58,7 +58,7 @@ impl<T> StartBound<T> {
/// an [`end_bound()`] in a range search
///
/// [`end_bound()`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html#tymethod.end_bound
pub(crate) fn as_end_bound(self) -> StartBound<T> {
pub(crate) fn into_end_bound(self) -> StartBound<T> {
match self {
//flipping is unnecessary
StartBound::Included(point) => StartBound::Included(point),
+5 -4
View File
@@ -119,9 +119,9 @@ along with range_bounds_map. If not, see <https://www.gnu.org/licenses/>.
//!
//! To summarise:
//!
//! - No coalescing insert functions, yet
//! - No coalescing/merge insert functions, yet
//! - No `gaps()` iterator function, yet
//! - Missing some functions common to BTreeMap and Set like:
//! - Missing some functions common to BTreeMap and BTreeSet like:
//! - `clear()`
//! - `is_subset()`
//! - etc... a bunch more
@@ -190,10 +190,11 @@ along with range_bounds_map. If not, see <https://www.gnu.org/licenses/>.
#![feature(is_some_and)]
#![feature(let_chains)]
#![allow(clippy::tabs_in_doc_comments)]
#![allow(clippy::needless_return)]
pub(crate) mod bounds;
pub mod range_bounds_map;
pub mod range_bounds_set;
pub use crate::range_bounds_map::RangeBoundsMap;
pub use crate::range_bounds_map::InsertError;
pub use crate::range_bounds_map::{InsertError, RangeBoundsMap};
pub use crate::range_bounds_set::RangeBoundsSet;
+4 -5
View File
@@ -112,7 +112,7 @@ use crate::bounds::StartBound;
///
/// [`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
/// [`BTreeMap`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct RangeBoundsMap<I, K, V> {
starts: BTreeMap<StartBound<I>, (K, V)>,
}
@@ -188,8 +188,7 @@ where
///
/// # Examples
/// ```
/// use range_bounds_map::RangeBoundsMap;
/// use range_bounds_map::InsertError;
/// use range_bounds_map::{InsertError, RangeBoundsMap};
///
/// let mut range_bounds_map = RangeBoundsMap::new();
///
@@ -221,7 +220,7 @@ where
let start = StartBound::from(range_bounds.start_bound().cloned());
//optimisation fix this without cloning
let end =
StartBound::from(range_bounds.end_bound().cloned()).as_end_bound();
StartBound::from(range_bounds.end_bound().cloned()).into_end_bound();
if start > end {
panic!("Invalid search range bounds!");
@@ -297,7 +296,7 @@ where
StartBound::from(search_range_bounds.start_bound().cloned());
//optimisation fix this without cloning
let end = StartBound::from(search_range_bounds.end_bound().cloned())
.as_end_bound();
.into_end_bound();
let start_range_bounds = (
//Included is lossless regarding meta-bounds searches
+2 -2
View File
@@ -89,6 +89,7 @@ use crate::InsertError;
///
/// [`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
/// [`BTreeSet`]: https://doc.rust-lang.org/std/collections/struct.BTreeSet.html
#[derive(Debug, Default)]
pub struct RangeBoundsSet<I, K> {
map: RangeBoundsMap<I, K, ()>,
}
@@ -145,8 +146,7 @@ where
///
/// # Examples
/// ```
/// use range_bounds_map::RangeBoundsSet;
/// use range_bounds_map::InsertError;
/// use range_bounds_map::{InsertError, RangeBoundsSet};
///
/// let mut range_bounds_set = RangeBoundsSet::new();
///
-2
View File
@@ -3,8 +3,6 @@
- add issues to github for all the caveats and cloned() optimisations
- review caveats again
- implement specific insert error/overlap error
- run cargo fmt
- run and fix cargo clippy
- take a look around idiomatic rust for a bit first