more lints

This commit is contained in:
Blaž Hrastnik 2021-02-18 18:45:41 +09:00
parent 0827c45d94
commit 4ab5631d65
2 changed files with 2 additions and 5 deletions

View file

@ -160,7 +160,7 @@ pub struct RopeGraphemes<'a> {
}
impl<'a> RopeGraphemes<'a> {
pub fn new<'b>(slice: RopeSlice<'b>) -> RopeGraphemes<'b> {
pub fn new(slice: RopeSlice) -> RopeGraphemes {
let mut chunks = slice.chunks();
let first_chunk = chunks.next().unwrap_or("");
RopeGraphemes {

View file

@ -13,15 +13,12 @@ pub mod syntax;
mod transaction;
pub(crate) fn find_first_non_whitespace_char2(line: RopeSlice) -> Option<usize> {
let mut start = 0;
// find first non-whitespace char
for ch in line.chars() {
for (start, ch) in line.chars().enumerate() {
// TODO: could use memchr with chunks?
if ch != ' ' && ch != '\t' && ch != '\n' {
return Some(start);
}
start += 1;
}
None