Skip to content

Commit 27a9333

Browse files
committed
Small format, remove unnecessary lifetimes
1 parent e7df1fb commit 27a9333

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/binary_search.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ use std::cmp::Ordering::{Equal, Greater, Less};
22

33
use crate::{fastcmp, IVec};
44

5-
pub(crate) fn binary_search_lub<'a>(
6-
key: &[u8],
7-
s: &'a [IVec],
8-
) -> Option<usize> {
5+
pub(crate) fn binary_search_lub(key: &[u8], s: &[IVec]) -> Option<usize> {
96
match binary_search(key, s) {
107
Ok(i) => Some(i),
118
Err(i) if i == 0 => None,
129
Err(i) => Some(i - 1),
1310
}
1411
}
1512

16-
pub fn binary_search<'a>(key: &[u8], s: &'a [IVec]) -> Result<usize, usize> {
13+
pub fn binary_search(key: &[u8], s: &[IVec]) -> Result<usize, usize> {
1714
let mut size = s.len();
1815
if size == 0 || *key < *s[0] {
1916
return Err(0);
@@ -35,7 +32,11 @@ pub fn binary_search<'a>(key: &[u8], s: &'a [IVec]) -> Result<usize, usize> {
3532
#[allow(unsafe_code)]
3633
let l = unsafe { s.get_unchecked(base).as_ref() };
3734
let cmp = fastcmp(l, key);
38-
if cmp == Equal { Ok(base) } else { Err(base + (cmp == Less) as usize) }
35+
if cmp == Equal {
36+
Ok(base)
37+
} else {
38+
Err(base + (cmp == Less) as usize)
39+
}
3940
}
4041

4142
#[test]

src/tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,12 +1517,12 @@ impl Tree {
15171517
Ok(())
15181518
}
15191519

1520-
fn root_hoist<'g>(
1520+
fn root_hoist(
15211521
&self,
15221522
from: PageId,
15231523
to: PageId,
15241524
at: IVec,
1525-
guard: &'g Guard,
1525+
guard: &Guard,
15261526
) -> Result<bool> {
15271527
M.tree_root_split_attempt();
15281528
// hoist new root, pointing to lhs & rhs

0 commit comments

Comments
 (0)