commit d89ddb0c3b0b3dc4056059753ff5481ff0d1a3e5
parent 6ec0cc996ad47915e782618bc04bbd0dd2c8115f
Author: William Casarin <jb55@jb55.com>
Date: Mon, 3 Jul 2023 11:08:46 -0700
warnings: fixup
Diffstat:
2 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/src/parser.rs b/src/parser.rs
@@ -1,5 +1,3 @@
-
-
#[derive(Debug, PartialEq, Eq)]
pub struct Parser<'a> {
data: &'a [u8],
@@ -119,7 +117,7 @@ impl<'a> Parser<'a> {
pub fn peek_prev_char(&self) -> Result<char> {
let mut i = 1;
- let mut codepoint = 0u32;
+ let codepoint: u32;
let mut bs: [u32; 4] = [0; 4];
if self.pos == 0 {
diff --git a/src/shard.rs b/src/shard.rs
@@ -34,7 +34,7 @@ pub enum Shard {
#[derive(Debug)]
pub struct Shards {
shards: Vec<Shard>,
- num_words: i32,
+ //num_words: i32,
}
impl Shards {
@@ -42,7 +42,6 @@ impl Shards {
Shards {
// some initial capacity so we don't have to allocate on small parses
shards: Vec::with_capacity(32),
- num_words: 0,
}
}
@@ -113,14 +112,6 @@ impl Shards {
}
}
-fn is_boundary(r: &Result<char>) -> bool {
- match r {
- Err(Error::OutOfBounds(_)) => true,
- Err(_) => false,
- Ok(c) => is_boundary_char(*c),
- }
-}
-
fn is_left_boundary(r: &Result<u8>) -> bool {
match r {
Err(Error::OutOfBounds(_)) => true,
@@ -129,13 +120,6 @@ fn is_left_boundary(r: &Result<u8>) -> bool {
}
}
-fn is_eof<T>(r: &Result<T>) -> bool {
- match r {
- Err(Error::OutOfBounds(Bound::End)) => true,
- _ => false,
- }
-}
-
fn is_boundary_char(c: char) -> bool {
c.is_ascii_whitespace() || c.is_ascii_punctuation()
}
@@ -151,6 +135,14 @@ mod test {
static INIT: Once = Once::new();
+ fn is_boundary(r: &Result<char>) -> bool {
+ match r {
+ Err(Error::OutOfBounds(_)) => true,
+ Err(_) => false,
+ Ok(c) => is_boundary_char(*c),
+ }
+ }
+
/// Setup function that is only run once, even if called multiple times.
fn setup() {
INIT.call_once(|| {