Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
noib3 committed May 27, 2024
1 parent 468818b commit 469896c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 31 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ criterion = "0.5"
rand = "0.8"
ropey = "1.6"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }

[[bench]]
name = "creation"
harness = false
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@
//! - `simd` (enabled by default): enables SIMD on supported platforms;
//!
//! - `graphemes` (disabled by default): enables a few grapheme-oriented APIs
//! on `Rope`s and `RopeSlice`s such as the
//! [`Graphemes`](crate::iter::Graphemes) iterator and others;
//! on `Rope`s and `RopeSlice`s such as the
//! [`Graphemes`](crate::iter::Graphemes) iterator and others;
//!
//! - `utf16-metric` (disabled by default): makes the `Rope` and `RopeSlice`
//! track the UTF-16 code units they'd have if their content was stored as
//! UTF-16 instead of UTF-8, allowing them to efficiently convert UTF-16
//! code unit offsets to and from byte offsets in logarithmic time.
//! track the UTF-16 code units they'd have if their content was stored as
//! UTF-16 instead of UTF-8, allowing them to efficiently convert UTF-16
//! code unit offsets to and from byte offsets in logarithmic time.
#![allow(clippy::explicit_auto_deref)]
#![allow(clippy::module_inception)]
Expand Down
7 changes: 4 additions & 3 deletions src/tree/node_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ impl<const N: usize, L: Leaf> Inode<N, L> {
/// - this inode has only one child (the second child is assumed to exist);
///
/// - the `Arc` enclosing the first child has a strong counter > 1. This
/// function assumes that there are zero `Arc::clone`s of the first child.
/// function assumes that there are zero `Arc::clone`s of the first
/// child.
#[inline]
pub(super) fn balance_first_child_with_second(&mut self)
where
Expand Down Expand Up @@ -340,10 +341,10 @@ impl<const N: usize, L: Leaf> Inode<N, L> {
/// Panics if:
///
/// - this inode has only one child (the penultimate child is assumed to
/// exist);
/// exist);
///
/// - the `Arc` enclosing the last child has a strong counter > 1. This
/// function assumes that there are zero `Arc::clone`s of the last child.
/// function assumes that there are zero `Arc::clone`s of the last child.
#[inline]
pub(super) fn balance_last_child_with_penultimate(&mut self)
where
Expand Down
4 changes: 2 additions & 2 deletions src/tree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ mod from_treeslice {
/// Returns a `(root, invalid_first, invalid_last)` tuple where:
///
/// - `root` is the internal node obtained by removing all the nodes before
/// `slice.before` and after `slice.before + slice.base_measure`,
/// `slice.before` and after `slice.before + slice.base_measure`,
///
/// - `invalid_{first,last}` are the number of invalid nodes contained in
/// the subtrees of the first and last child, respectively.
/// the subtrees of the first and last child, respectively.
///
/// Note that all the `Arc`s enclosing the nodes on the left and right side
/// of the subtree under `root` are guaranteed to have a strong count of 1,
Expand Down
10 changes: 5 additions & 5 deletions src/tree/tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ pub struct TreeBuilder<const ARITY: usize, L: Leaf> {
/// - all the inodes within a stack level have the same depth;
///
/// - all the vectors at every stack level have a length strictly less than
/// `ARITY` (but it could also be zero, i.e. all levels except the first
/// one can be empty);
/// `ARITY` (but it could also be zero, i.e. all levels except the first
/// one can be empty);
///
/// - the inodes are grouped in order of descending depth, with each stack
/// level containing inodes of depth one less than the previous level;
/// level containing inodes of depth one less than the previous level;
///
/// - every inode at every stack level is completely full, i.e. for every
/// inode it holds `inode.leaf_count() == max_children ^ inode.depth()`;
/// inode it holds `inode.leaf_count() == max_children ^ inode.depth()`;
///
/// - all the inodes in the last stack level (assuming there are any) have
/// a depth of 1.
/// a depth of 1.
stack: Vec<Vec<Arc<Node<ARITY, L>>>>,

/// A bunch of leaves waiting to be grouped into an internal node.
Expand Down
32 changes: 16 additions & 16 deletions src/tree/units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,17 +464,17 @@ impl<'a, const N: usize, L: Leaf, M: UnitMetric<L>> UnitsForward<'a, N, L, M> {
/// - `leaf` is that leaf node;
///
/// - `root` is the deepest internal node containing both the current
/// `self.leaf_node` and `leaf` in its subtree;
/// `self.leaf_node` and `leaf` in its subtree;
///
/// - `before` is the total base measure of all the nodes from the first
/// leaf in `root`'s subtree to the leaf preceding the current
/// `self.leaf_node`. If `self.leaf_node` is the first leaf in `root`'s
/// subtree this measure will be zero;
/// leaf in `root`'s subtree to the leaf preceding the current
/// `self.leaf_node`. If `self.leaf_node` is the first leaf in `root`'s
/// subtree this measure will be zero;
///
/// - `summary` and `count` are the total summary and leaf count of all the
/// nodes between (but not including) `self.leaf_node` and `leaf`. If
/// `leaf` is the leaf node immediately after `self.leaf` then `summary`
/// will be empty and `count` will be zero.
/// nodes between (but not including) `self.leaf_node` and `leaf`. If
/// `leaf` is the leaf node immediately after `self.leaf` then `summary`
/// will be empty and `count` will be zero.
///
/// NOTE: it assumes that such a leaf node exists. If that's not the case
/// this function may panic or return a leaf node outside of the valid
Expand Down Expand Up @@ -1280,8 +1280,8 @@ impl<'a, const N: usize, L: Leaf, M: DoubleEndedUnitMetric<L>>

/// Yields the first unit in the range. This function is used by
///
/// - [`Self::remainder()`] if there are no units in the iterating range, in
/// which case it'll yield the whole range;
/// - [`Self::remainder()`] if there are no units in the iterating range,
/// in which case it'll yield the whole range;
///
/// - by [`Self::previous()`] when there's one final unit to yield.
#[inline]
Expand Down Expand Up @@ -1424,17 +1424,17 @@ impl<'a, const N: usize, L: Leaf, M: DoubleEndedUnitMetric<L>>
/// - `leaf` is that leaf node;
///
/// - `root` is the deepest internal node containing both `leaf` and the
/// current `self.leaf_node` in its subtree;
/// current `self.leaf_node` in its subtree;
///
/// - `after` is the total base measure of all the nodes from the last leaf
/// in `root`'s subtree to the leaf after the current `self.leaf_node`. If
/// `self.leaf_node` if the last leaf in `root`'s subtree this measure will
/// be zero;
/// in `root`'s subtree to the leaf after the current `self.leaf_node`.
/// If `self.leaf_node` if the last leaf in `root`'s subtree this measure
/// will be zero;
///
/// - `summary` and `count` are the total summary and leaf count of all the
/// nodes between (but not including) `leaf` and `self.leaf_node`. If
/// `leaf` is the leaf node immediately before `self.leaf` then `summary`
/// will be empty and `count` will be zero.
/// nodes between (but not including) `leaf` and `self.leaf_node`. If
/// `leaf` is the leaf node immediately before `self.leaf` then `summary`
/// will be empty and `count` will be zero.
///
/// NOTE: it assumes that such a leaf node exists. If that's not the case
/// this function may panic or return a leaf node outside of the valid
Expand Down

0 comments on commit 469896c

Please sign in to comment.