on master help sign in
more lints
4ab5631Blaž Hrastnik
helix-core/src/graphemes.rs+1−1
@@ -160,7 +160,7 @@ pub struct RopeGraphemes<'a> {
160}
160}
161
161
162impl<'a> RopeGraphemes<'a> {
162impl<'a> RopeGraphemes<'a> {
163− pub fn new<'b>(slice: RopeSlice<'b>) -> RopeGraphemes<'b> {
163+ pub fn new(slice: RopeSlice) -> RopeGraphemes {
164 let mut chunks = slice.chunks();
164 let mut chunks = slice.chunks();
165 let first_chunk = chunks.next().unwrap_or("");
165 let first_chunk = chunks.next().unwrap_or("");
166 RopeGraphemes {
166 RopeGraphemes {
helix-core/src/lib.rs+1−4
@@ -13,15 +13,12 @@ pub mod syntax;
13mod transaction;
13mod transaction;
14
14
15pub(crate) fn find_first_non_whitespace_char2(line: RopeSlice) -> Option<usize> {
15pub(crate) fn find_first_non_whitespace_char2(line: RopeSlice) -> Option<usize> {
16− let mut start = 0;
17−
18 // find first non-whitespace char
16 // find first non-whitespace char
19− for ch in line.chars() {
17+ for (start, ch) in line.chars().enumerate() {
20 // TODO: could use memchr with chunks?
18 // TODO: could use memchr with chunks?
21 if ch != ' ' && ch != '\t' && ch != '\n' {
19 if ch != ' ' && ch != '\t' && ch != '\n' {
22 return Some(start);
20 return Some(start);
23 }
21 }
24− start += 1;
25 }
22 }
26
23
27 None
24 None