Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
Signed-off-by: FedericoBruzzone <[email protected]>
  • Loading branch information
FedericoBruzzone committed Apr 14, 2024
1 parent fef2b1a commit b764aa9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/utf16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn encode_code_point(unicode_cp: u32) -> Vec<u16> {
/// Decode a UTF-16 code point into a unicode code point.
///
/// # Parameters
/// * `utf16_cp`: [`&Vec<u16>`] - A vector of UTF-16 code points.
/// * `utf16_cp`: [`&[u16]`] - A slice of UTF-16 code points.
/// * `i`: [`usize`] - The index of the byte to read.
///
/// # Returns
Expand All @@ -98,7 +98,7 @@ fn encode_code_point(unicode_cp: u32) -> Vec<u16> {
/// # Panics
/// * If the index `i` is out of bounds.
/// * If the UTF-16 code point is invalid.
fn decode_symbol(utf16_cp: &Vec<u16>, i: usize) -> Option<(u32, usize)> {
fn decode_symbol(utf16_cp: &[u16], i: usize) -> Option<(u32, usize)> {
if i > utf16_cp.len() {
panic!("Index out of bounds");
}
Expand Down
8 changes: 4 additions & 4 deletions src/utf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn encode_code_point(unicode_cp: u32) -> Vec<u8> {
/// Read the next byte from a vector of UTF-8 code points.
///
/// # Parameters
/// * `byte_vec`: [`&Vec<u8>`] - A vector of UTF-8 code points.
/// * `byte_vec`: [`&[u8]`] - A slice of UTF-8 code points.
/// * `i`: [`usize`] - The index of the byte to read.
///
/// # Returns
Expand All @@ -148,7 +148,7 @@ fn encode_code_point(unicode_cp: u32) -> Vec<u8> {
/// # Panics
/// * If the index `i` is out of bounds.
/// * If the byte at index `i` is not a continuation byte.
fn read_next_byte(byte_vec: &Vec<u8>, i: usize) -> u32 {
fn read_next_byte(byte_vec: &[u8], i: usize) -> u32 {
if i >= byte_vec.len() {
panic!("Index out of bounds");
}
Expand All @@ -173,7 +173,7 @@ fn read_next_byte(byte_vec: &Vec<u8>, i: usize) -> u32 {
/// Decode a UTF-8 code point into a unicode code point.
///
/// # Parameters
/// * `utf8_cp`: [`&Vec<u8>`] - A vector of UTF-8 code points.
/// * `utf8_cp`: [`&[u8]`] - A slice of UTF-8 code points.
/// * `i`: [`usize`] - The index of the byte to read. It should be the index of a prefix byte.
///
/// # Returns
Expand All @@ -185,7 +185,7 @@ fn read_next_byte(byte_vec: &Vec<u8>, i: usize) -> u32 {
/// * If the index `i` is out of bounds.
/// * If, after reading the first byte, the continuation bytes are not valid.
/// * If the UTF-8 code point is invalid.
fn decode_symbol(utf8_cp: &Vec<u8>, i: usize) -> Option<(u32, usize)> {
fn decode_symbol(utf8_cp: &[u8], i: usize) -> Option<(u32, usize)> {
if i > utf8_cp.len() {
panic!("Index out of bounds");
}
Expand Down

0 comments on commit b764aa9

Please sign in to comment.