Skip to content

Commit

Permalink
fix cargo clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonVandeVyver committed Sep 12, 2024
1 parent d1d8f88 commit b145e77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bitarray/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl BitArray {
/// * `index` - The index of the value to set.
/// * `value` - The value to set at the specified index.
pub fn set(&mut self, index: usize, value: u64) {
let value: u64 = value.into();
let value: u64 = value;
let start_block = index * self.bits_per_value / 64;
let start_block_offset = index * self.bits_per_value % 64;

Expand Down
10 changes: 5 additions & 5 deletions sa-index/src/sa_searcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ impl Searcher {
// match as long as possible
while index_in_search_string < search_string.len()
&& index_in_suffix < self.proteins.text.len()
&& (search_string[index_in_search_string] == self.proteins.text.get(index_in_suffix) as u8
&& (search_string[index_in_search_string] == self.proteins.text.get(index_in_suffix)
|| (search_string[index_in_search_string] == b'L'
&& self.proteins.text.get(index_in_suffix) as u8 == b'I')
&& self.proteins.text.get(index_in_suffix) == b'I')
|| (search_string[index_in_search_string] == b'I'
&& self.proteins.text.get(index_in_suffix) as u8 == b'L'))
&& self.proteins.text.get(index_in_suffix) == b'L'))
{
index_in_suffix += 1;
index_in_search_string += 1;
Expand All @@ -201,10 +201,10 @@ impl Searcher {
search_string[index_in_search_string]
};

let protein_char = if self.proteins.text.get(index_in_suffix) as u8 == b'L' {
let protein_char = if self.proteins.text.get(index_in_suffix) == b'L' {
b'I'
} else {
self.proteins.text.get(index_in_suffix) as u8
self.proteins.text.get(index_in_suffix)
};

is_cond_or_equal = condition_check(peptide_char, protein_char);
Expand Down
6 changes: 5 additions & 1 deletion text-compression/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl ProteinText {
/// # Returns
///
/// An instance of `ProteinText`
pub fn from_vec(input_vec: &Vec<u8>) -> ProteinText {
pub fn from_vec(input_vec: &[u8]) -> ProteinText {
let char_to_5bit = ProteinText::create_char_to_5bit_hashmap();
let bit5_to_char = ProteinText::create_bit5_to_char();

Expand Down Expand Up @@ -223,6 +223,10 @@ impl<'a> ProteinTextSlice<'a> {
self.end - self.start
}

pub fn is_empty(&self) -> bool {
self.len() == 0
}

/// Checks if the slice and a given array of `u8` are equal.
/// I and L can be equated.
///
Expand Down

0 comments on commit b145e77

Please sign in to comment.