Run clippy on CI

Fixes #1402.
This commit is contained in:
Kirill Chibisov 2022-06-10 13:43:33 +03:00 committed by GitHub
parent 57981b533d
commit 10419ff441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 377 additions and 312 deletions

View file

@ -65,12 +65,10 @@ extern "C" fn preedit_done_callback(
.expect("failed to send preedit end event");
}
fn calc_byte_position(text: &Vec<char>, pos: usize) -> usize {
let mut byte_pos = 0;
for i in 0..pos {
byte_pos += text[i].len_utf8();
}
byte_pos
fn calc_byte_position(text: &[char], pos: usize) -> usize {
text.iter()
.take(pos)
.fold(0, |byte_pos, text| byte_pos + text.len_utf8())
}
/// Preedit text information to be drawn inline by the client.