Merge remote-tracking branch 'origin/master' into no_std
This commit is contained in:
@@ -45,8 +45,8 @@ where
|
||||
C: Comparator<K>,
|
||||
{
|
||||
/// Create a new empty forest.
|
||||
pub fn new() -> MapForest<K, V, C> {
|
||||
MapForest { nodes: NodePool::new() }
|
||||
pub fn new() -> Self {
|
||||
Self { nodes: NodePool::new() }
|
||||
}
|
||||
|
||||
/// Clear all maps in the forest.
|
||||
@@ -83,8 +83,8 @@ where
|
||||
C: Comparator<K>,
|
||||
{
|
||||
/// Make an empty map.
|
||||
pub fn new() -> Map<K, V, C> {
|
||||
Map {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
root: None.into(),
|
||||
unused: PhantomData,
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ impl<F: Forest> NodeData<F> {
|
||||
}
|
||||
|
||||
/// Create an inner node with a single key and two sub-trees.
|
||||
pub fn inner(left: Node, key: F::Key, right: Node) -> NodeData<F> {
|
||||
pub fn inner(left: Node, key: F::Key, right: Node) -> Self {
|
||||
// Splat the key and right node to the whole array.
|
||||
// Saves us from inventing a default/reserved value.
|
||||
let mut tree = [right; INNER_SIZE];
|
||||
@@ -86,7 +86,7 @@ impl<F: Forest> NodeData<F> {
|
||||
}
|
||||
|
||||
/// Create a leaf node with a single key-value pair.
|
||||
pub fn leaf(key: F::Key, value: F::Value) -> NodeData<F> {
|
||||
pub fn leaf(key: F::Key, value: F::Value) -> Self {
|
||||
NodeData::Leaf {
|
||||
size: 1,
|
||||
keys: F::splat_key(key),
|
||||
@@ -360,7 +360,7 @@ impl<F: Forest> NodeData<F> {
|
||||
///
|
||||
/// In the first case, `None` is returned. In the second case, the new critical key for the
|
||||
/// right sibling node is returned.
|
||||
pub fn balance(&mut self, crit_key: F::Key, rhs: &mut NodeData<F>) -> Option<F::Key> {
|
||||
pub fn balance(&mut self, crit_key: F::Key, rhs: &mut Self) -> Option<F::Key> {
|
||||
match (self, rhs) {
|
||||
(&mut NodeData::Inner {
|
||||
size: ref mut l_size,
|
||||
@@ -514,7 +514,7 @@ pub(super) enum Removed {
|
||||
|
||||
impl Removed {
|
||||
/// Create a `Removed` status from a size and capacity.
|
||||
fn new(removed: usize, new_size: usize, capacity: usize) -> Removed {
|
||||
fn new(removed: usize, new_size: usize, capacity: usize) -> Self {
|
||||
if 2 * new_size >= capacity {
|
||||
if removed == new_size {
|
||||
Removed::Rightmost
|
||||
|
||||
@@ -22,8 +22,8 @@ pub(super) struct Path<F: Forest> {
|
||||
}
|
||||
|
||||
impl<F: Forest> Default for Path<F> {
|
||||
fn default() -> Path<F> {
|
||||
Path {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
size: 0,
|
||||
node: [Node(0); MAX_PATH],
|
||||
entry: [0; MAX_PATH],
|
||||
|
||||
@@ -12,8 +12,8 @@ pub(super) struct NodePool<F: Forest> {
|
||||
|
||||
impl<F: Forest> NodePool<F> {
|
||||
/// Allocate a new empty pool of nodes.
|
||||
pub fn new() -> NodePool<F> {
|
||||
NodePool {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
nodes: PrimaryMap::new(),
|
||||
freelist: None,
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ where
|
||||
C: Comparator<K>,
|
||||
{
|
||||
/// Create a new empty forest.
|
||||
pub fn new() -> SetForest<K, C> {
|
||||
SetForest { nodes: NodePool::new() }
|
||||
pub fn new() -> Self {
|
||||
Self { nodes: NodePool::new() }
|
||||
}
|
||||
|
||||
/// Clear all sets in the forest.
|
||||
@@ -78,8 +78,8 @@ where
|
||||
C: Comparator<K>,
|
||||
{
|
||||
/// Make an empty set.
|
||||
pub fn new() -> Set<K, C> {
|
||||
Set {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
root: None.into(),
|
||||
unused: PhantomData,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user