(
scored: &mut Vec<(String, i32)>,
dedup: &mut HashMap<String, ()>,
token: &str,
token_lower: &str,
item: String,
pre_scored: Option<i32>,
)
| 751 | } |
| 752 | |
| 753 | fn push_candidate( |
| 754 | scored: &mut Vec<(String, i32)>, |
| 755 | dedup: &mut HashMap<String, ()>, |
| 756 | token: &str, |
| 757 | token_lower: &str, |
| 758 | item: String, |
| 759 | pre_scored: Option<i32>, |
| 760 | ) { |
| 761 | if item.eq_ignore_ascii_case(token) { |
| 762 | return; |
| 763 | } |
| 764 | if dedup.insert(item.to_lowercase(), ()).is_some() { |
| 765 | return; |
| 766 | } |
| 767 | |
| 768 | let score = pre_scored |
| 769 | .or_else(|| crate::command::fuzzy_match(token, &item)) |
| 770 | .or_else(|| { |
| 771 | if item.to_lowercase().starts_with(token_lower) { |
| 772 | Some(1) |
| 773 | } else { |
| 774 | None |
| 775 | } |
| 776 | }); |
| 777 | if let Some(score) = score { |
| 778 | scored.push((item, score)); |
| 779 | } |
| 780 | } |
| 781 | |
| 782 | fn recompute_suggestions(&mut self) { |
| 783 | let Some((_, _, token)) = self.current_token() else { |
nothing calls this directly
no test coverage detected