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

Commit55666d7

Browse files
NoraCodesnptr
authored andcommitted
Variable naming pedantry
1 parent7cedb2f commit55666d7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎iui/src/str_tools.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ pub fn strip_dual_endings(s: &str) -> String {
1111

1212
/// Replaces every occurrence of `"\n"` not led by `"\r"` with `"\r\n"`.
1313
pubfninsert_dual_endings(s:&str) ->String{
14-
letmutns =String::with_capacity(s.len() +2);
15-
letmutcr =false;
16-
for(_,d)in s.char_indices(){
17-
ifd =='\n' && !cr{
18-
ns.push('\r');
14+
letmutnew_string =String::with_capacity(s.len() +2);
15+
letmutprev_was_cr =false;
16+
for(_,character)in s.char_indices(){
17+
ifcharacter =='\n' && !prev_was_cr{
18+
new_string.push('\r');
1919
}
2020

21-
ns.push(d);
22-
cr =d =='\r';
21+
new_string.push(character);
22+
prev_was_cr =character =='\r';
2323
}
24-
returnns;
24+
returnnew_string;
2525
}
2626

2727
/// Converts a &str to a CString, using either LF or CRLF as appropriate.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp