mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 20:14:45 +00:00
Fix warns
This commit is contained in:
parent
a79f0652ab
commit
5366bfadc4
3 changed files with 6 additions and 8 deletions
|
@ -36,7 +36,7 @@ impl Add<&str> for AtomicStr {
|
|||
impl Hash for AtomicStr {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
match self {
|
||||
AtomicStr::Arc(s) => (&s[..]).hash(state),
|
||||
AtomicStr::Arc(s) => s[..].hash(state),
|
||||
AtomicStr::Static(s) => (*s).hash(state),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,16 @@ pub fn levenshtein(lhs: &str, rhs: &str) -> usize {
|
|||
let r_len = rhs.len();
|
||||
// l_len+1 × r_len+1 array
|
||||
let mut table = vec![vec![0; r_len + 1]; l_len + 1];
|
||||
let _ = table
|
||||
table
|
||||
.iter_mut()
|
||||
.take(l_len + 1)
|
||||
.enumerate()
|
||||
.map(|(i, row)| row[0] = i)
|
||||
.collect::<()>();
|
||||
let _ = table[0]
|
||||
.for_each(|(i, row)| row[0] = i);
|
||||
table[0]
|
||||
.iter_mut()
|
||||
.take(r_len + 1)
|
||||
.enumerate()
|
||||
.map(|(i, elem)| *elem = i)
|
||||
.collect::<()>();
|
||||
.for_each(|(i, elem)| *elem = i);
|
||||
for i1 in 0..l_len {
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for i2 in 0..r_len {
|
||||
|
|
|
@ -32,7 +32,7 @@ impl Add<&str> for Str {
|
|||
impl Hash for Str {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
match self {
|
||||
Str::Rc(s) => (&s[..]).hash(state),
|
||||
Str::Rc(s) => s[..].hash(state),
|
||||
Str::Static(s) => (*s).hash(state),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue