Skip to content

Commit 9b25bf8

Browse files
committed
fix some clippy warnings
1 parent d0731d1 commit 9b25bf8

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

crates/node/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl Scanner {
128128
input: ChangedContent,
129129
) -> Vec<CandidateWithPosition> {
130130
let content = input.content.unwrap_or_else(|| {
131-
std::fs::read_to_string(&input.file.unwrap()).expect("Failed to read file")
131+
std::fs::read_to_string(input.file.unwrap()).expect("Failed to read file")
132132
});
133133

134134
let input = ChangedContent {

crates/node/src/utf16.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,18 @@ impl<'a> IndexConverter<'a> {
3131
// will only ever be incremented up to the length of the input string.
3232
//
3333
// This eliminates a "potential" panic that cannot actually happen
34-
let slice = unsafe {
35-
self.input.get_unchecked(self.curr_utf8..)
36-
};
34+
let slice = unsafe { self.input.get_unchecked(self.curr_utf8..) };
3735

3836
for c in slice.chars() {
3937
if self.curr_utf8 >= pos {
40-
break
38+
break;
4139
}
4240

4341
self.curr_utf8 += c.len_utf8();
4442
self.curr_utf16 += c.len_utf16();
4543
}
4644

47-
return self.curr_utf16 as i64;
45+
self.curr_utf16 as i64
4846
}
4947
}
5048

@@ -66,19 +64,16 @@ mod test {
6664
(4, 4),
6765
(5, 5),
6866
(6, 6),
69-
7067
// inside the 🔥
7168
(7, 8),
7269
(8, 8),
7370
(9, 8),
7471
(10, 8),
75-
7672
// inside the 🥳
7773
(11, 10),
7874
(12, 10),
7975
(13, 10),
8076
(14, 10),
81-
8277
// <space>world!
8378
(15, 11),
8479
(16, 12),
@@ -87,7 +82,6 @@ mod test {
8782
(19, 15),
8883
(20, 16),
8984
(21, 17),
90-
9185
// Past the end should return the last utf-16 character index
9286
(22, 17),
9387
(100, 17),

0 commit comments

Comments
 (0)