Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/rariPublic

Commit59f3bf6

Browse files
committed
style(clippy): fix issues
1 parentabfc030 commit59f3bf6

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

‎crates/rari-doc/src/position_utils.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@ pub fn byte_to_char_column(line: &str, byte_offset: usize) -> usize {
8383
/// ```
8484
pubfnchar_to_byte_column(line:&str,char_offset:usize) ->usize{
8585
letmut byte_pos =0;
86-
letmut char_count =0;
8786

88-
forchin line.chars(){
87+
for(char_count, ch)in line.chars().enumerate(){
8988
if char_count >= char_offset{
9089
return byte_pos;
9190
}
9291
byte_pos += ch.len_utf8();
93-
char_count +=1;
9492
}
9593

9694
byte_pos

‎crates/rari-tools/src/fix/issues.rs‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,18 @@ fn calc_offset(input: &str, olc: OLCMapper, new_line: usize, new_column: usize)
293293
None
294294
};
295295
// Verify the calculated offset is on a UTF-8 character boundary
296-
ifletSome(mut offset_value) = offset{
297-
if offset_value < input.len() && !input.is_char_boundary(offset_value){
298-
tracing::warn!(
299-
"calculated offset {} is not on char boundary - adjusting (this may indicate a bug)",
300-
offset_value
301-
);
302-
// Move backwards to the nearest char boundary
303-
while offset_value >0 && !input.is_char_boundary(offset_value){
304-
offset_value -=1;
305-
}
306-
returnSome(offset_value);
296+
ifletSome(mut offset_value) = offset
297+
&& offset_value < input.len() && !input.is_char_boundary(offset_value)
298+
{
299+
tracing::warn!(
300+
"calculated offset {} is not on char boundary - adjusting (this may indicate a bug)",
301+
offset_value
302+
);
303+
// Move backwards to the nearest char boundary
304+
while offset_value >0 && !input.is_char_boundary(offset_value){
305+
offset_value -=1;
307306
}
307+
returnSome(offset_value);
308308
}
309309
offset
310310
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp