Skip to content

Commit c7b8bbd

Browse files
authored
Merge pull request #568 from ratmice/reorder_indent_args
Reorder arguments to indent fn.
2 parents 32d9456 + a19ed0c commit c7b8bbd

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

lrlex/src/lib/ctbuilder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ where
476476
lex_diag.file_location_msg(" parsing the `%grmtools` section", None)
477477
));
478478
for e in es {
479-
out.push_str(&indent(&lex_diag.format_error(e).to_string(), " "));
479+
out.push_str(&indent(" ", &lex_diag.format_error(e).to_string()));
480480
out.push('\n');
481481
}
482482
ErrorString(out)
@@ -511,7 +511,7 @@ where
511511
lex_diag.file_location_msg("", None)
512512
));
513513
for e in errs {
514-
out.push_str(&indent(&lex_diag.format_error(e).to_string(), " "));
514+
out.push_str(&indent(" ", &lex_diag.format_error(e).to_string()));
515515
out.push('\n');
516516
}
517517
ErrorString(out)
@@ -1168,7 +1168,7 @@ pub fn ct_token_map<StorageT: Display>(
11681168
///
11691169
/// It is plausible that we should a step 4, but currently do not:
11701170
/// 4. Replace all `\n{indent}\n` with `\n\n`
1171-
fn indent(s: &str, indent: &str) -> String {
1171+
fn indent(indent: &str, s: &str) -> String {
11721172
format!("{indent}{}\n", s.trim_end_matches('\n')).replace('\n', &format!("\n{}", indent))
11731173
}
11741174

lrpar/src/lib/ctbuilder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ where
566566
yacc_diag.file_location_msg(" parsing the `%grmtools` section", None)
567567
));
568568
for e in errs {
569-
out.push_str(&indent(&yacc_diag.format_error(e).to_string(), " "));
569+
out.push_str(&indent(" ", &yacc_diag.format_error(e).to_string()));
570570
}
571571
return Err(ErrorString(out))?;
572572
}
@@ -606,7 +606,7 @@ where
606606
for e in warnings {
607607
out.push_str(&format!(
608608
"{}\n",
609-
indent(&yacc_diag.format_warning(e).to_string(), " ")
609+
indent(" ", &yacc_diag.format_warning(e).to_string())
610610
));
611611
}
612612
return Err(ErrorString(out))?;
@@ -615,7 +615,7 @@ where
615615
if !warnings.is_empty() {
616616
for w in warnings {
617617
let ws_loc = yacc_diag.file_location_msg("", None);
618-
let ws = indent(&yacc_diag.format_warning(w).to_string(), " ");
618+
let ws = indent(" ", &yacc_diag.format_warning(w).to_string());
619619
// Assume if this variable is set we are running under cargo.
620620
if std::env::var("OUT_DIR").is_ok() && self.show_warnings {
621621
println!("cargo:warning={}", ws_loc);
@@ -635,7 +635,7 @@ where
635635
yacc_diag.file_location_msg("", None)
636636
));
637637
for e in errs {
638-
out.push_str(&indent(&yacc_diag.format_error(e).to_string(), " "));
638+
out.push_str(&indent(" ", &yacc_diag.format_error(e).to_string()));
639639
out.push('\n');
640640
}
641641

@@ -1544,7 +1544,7 @@ where
15441544
///
15451545
/// It is plausible that we should a step 4, but currently do not:
15461546
/// 4. Replace all `\n{indent}\n` with `\n\n`
1547-
fn indent(s: &str, indent: &str) -> String {
1547+
fn indent(indent: &str, s: &str) -> String {
15481548
format!("{indent}{}\n", s.trim_end_matches('\n')).replace('\n', &format!("\n{}", indent))
15491549
}
15501550

nimbleparse/src/main.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn read_file<P: AsRef<Path>>(path: P) -> String {
6363
///
6464
/// It is plausible that we should a step 4, but currently do not:
6565
/// 4. Replace all `\n{indent}\n` with `\n\n`
66-
fn indent(s: &str, indent: &str) -> String {
66+
fn indent(indent: &str, s: &str) -> String {
6767
format!("{indent}{}\n", s.trim_end_matches('\n')).replace('\n', &format!("\n{}", indent))
6868
}
6969

@@ -180,7 +180,7 @@ fn main() {
180180
Err(errs) => {
181181
eprintln!("{ERROR}{}", lex_diag.file_location_msg("", None));
182182
for e in errs {
183-
eprintln!("{}", indent(&lex_diag.format_error(e).to_string(), " "));
183+
eprintln!("{}", indent(" ", &lex_diag.format_error(e).to_string()));
184184
}
185185
process::exit(1);
186186
}
@@ -204,7 +204,7 @@ fn main() {
204204
yacc_diag.file_location_msg(" parsing the `%grmtools` section:", None)
205205
);
206206
for e in errs {
207-
eprintln!("{}", indent(&yacc_diag.format_error(e).to_string(), " "));
207+
eprintln!("{}", indent(" ", &yacc_diag.format_error(e).to_string()));
208208
}
209209
std::process::exit(1);
210210
}
@@ -238,7 +238,7 @@ fn main() {
238238
};
239239
eprintln!(
240240
"{}",
241-
indent(&yacc_diag.format_error(spanned_e).to_string(), " ")
241+
indent(" ", &yacc_diag.format_error(spanned_e).to_string())
242242
);
243243
process::exit(1)
244244
}
@@ -255,19 +255,19 @@ fn main() {
255255
if !warnings.is_empty() {
256256
eprintln!("{WARNING}{}", yacc_diag.file_location_msg("", None));
257257
for w in warnings {
258-
eprintln!("{}", indent(&yacc_diag.format_warning(w), " "));
258+
eprintln!("{}", indent(" ", &yacc_diag.format_warning(w)));
259259
}
260260
}
261261
x
262262
}
263263
Err(errs) => {
264264
eprintln!("{ERROR}{}", yacc_diag.file_location_msg("", None));
265265
for e in errs {
266-
eprintln!("{}", indent(&yacc_diag.format_error(e).to_string(), " "));
266+
eprintln!("{}", indent(" ", &yacc_diag.format_error(e).to_string()));
267267
}
268268
eprintln!("{WARNING}{}", yacc_diag.file_location_msg("", None));
269269
for w in warnings {
270-
eprintln!("{}", indent(&yacc_diag.format_warning(w), " "));
270+
eprintln!("{}", indent(" ", &yacc_diag.format_warning(w)));
271271
}
272272
process::exit(1);
273273
}

0 commit comments

Comments
 (0)