Skip to content

Commit

Permalink
clippy.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedruszhang committed Jul 9, 2023
1 parent 9f27441 commit 37b9ed0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ impl Model {
let create_buffer_f32 = |data: &[f32]| -> Buffer {
device.create_buffer_init(&BufferInitDescriptor {
label: None,
contents: cast_slice(&data),
contents: cast_slice(data),
usage: BufferUsages::STORAGE | BufferUsages::COPY_DST | BufferUsages::COPY_SRC,
})
};
Expand Down
9 changes: 4 additions & 5 deletions src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,12 @@ impl Tokenizer {
output: &mut Vec<u16>,
) -> Result<(), TokenizerError> {
'next_token: while !input.is_empty() {
let lengths;
if input.len() >= 2 {
let lengths = if input.len() >= 2 {
let key = u16::from_ne_bytes([input[0], input[1]]) as usize;
lengths = &self.first_bytes_to_lengths[key][..];
&self.first_bytes_to_lengths[key][..]
} else {
lengths = &[1][..];
}
&[1][..]
};

for &length in lengths {
let length = length as usize;
Expand Down

0 comments on commit 37b9ed0

Please sign in to comment.