@@ -5,19 +5,19 @@ use tracing::debug;
5
5
6
6
use crate :: model:: ModName ;
7
7
8
- const SCORE_THRESHOLD : i32 = 75 ;
8
+ const SCORE_THRESHOLD : i64 = 75 ;
9
9
10
10
pub trait Answer {
11
11
fn is_no ( & self ) -> bool ;
12
12
fn is_yes ( & self ) -> bool ;
13
13
}
14
14
15
- pub trait Index < T > {
15
+ pub trait Indexed < T > {
16
16
fn get_item ( & self , name : & ModName ) -> Option < & T > ;
17
17
fn search ( & self , term : & str ) -> Vec < & T > ;
18
18
}
19
19
20
- impl Index < Mod > for Vec < Mod > {
20
+ impl Indexed < Mod > for Vec < Mod > {
21
21
fn get_item ( & self , name : & ModName ) -> Option < & Mod > {
22
22
self . iter ( ) . find ( |v| {
23
23
v. name . to_lowercase ( ) == name. name . to_lowercase ( )
@@ -31,24 +31,24 @@ impl Index<Mod> for Vec<Mod> {
31
31
}
32
32
let matcher = SkimMatcherV2 :: default ( ) ;
33
33
let mut res = vec ! [ ] ;
34
- for v in self . iter ( ) {
34
+ for v in self {
35
35
let author = matcher. fuzzy_indices ( & v. author , term) ;
36
36
let name = matcher. fuzzy_indices ( & v. name , term) ;
37
37
let desc = matcher. fuzzy_indices ( & v. get_latest ( ) . unwrap ( ) . desc , term) ;
38
38
39
39
if let Some ( ( score, _) ) = author {
40
40
debug ! ( "author matched with score '{score}'" ) ;
41
- if score >= SCORE_THRESHOLD as i64 {
41
+ if score >= SCORE_THRESHOLD {
42
42
res. push ( ( score, v) ) ;
43
43
}
44
44
} else if let Some ( ( score, _) ) = name {
45
45
debug ! ( "name matched with score '{score}'" ) ;
46
- if score >= SCORE_THRESHOLD as i64 {
46
+ if score >= SCORE_THRESHOLD {
47
47
res. push ( ( score, v) ) ;
48
48
}
49
49
} else if let Some ( ( score, _) ) = desc {
50
50
debug ! ( "desc matched with score '{score}'" ) ;
51
- if score >= SCORE_THRESHOLD as i64 {
51
+ if score >= SCORE_THRESHOLD {
52
52
res. push ( ( score, v) ) ;
53
53
}
54
54
}
@@ -59,7 +59,7 @@ impl Index<Mod> for Vec<Mod> {
59
59
}
60
60
}
61
61
62
- impl Index < InstalledMod > for Vec < InstalledMod > {
62
+ impl Indexed < InstalledMod > for Vec < InstalledMod > {
63
63
fn get_item ( & self , name : & ModName ) -> Option < & InstalledMod > {
64
64
self . iter ( )
65
65
. find ( |v| v. mod_json . name . to_lowercase ( ) == name. name . to_lowercase ( ) )
0 commit comments