1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 11:46:17 +00:00

refactor/ptx ~ fix cargo clippy complaint (clippy::needless_borrow)

This commit is contained in:
Roy Ivy III 2021-06-05 22:01:57 -05:00
parent 750b68a44c
commit 84e08cd071

View file

@ -213,7 +213,7 @@ fn read_input(input_files: &[String], config: &Config) -> FileMap {
files.push("-"); files.push("-");
} else if config.gnu_ext { } else if config.gnu_ext {
for file in input_files { for file in input_files {
files.push(&file); files.push(file);
} }
} else { } else {
files.push(&input_files[0]); files.push(&input_files[0]);
@ -503,7 +503,7 @@ fn format_tex_line(
let keyword = &line[word_ref.position..word_ref.position_end]; let keyword = &line[word_ref.position..word_ref.position_end];
let after_chars_trim_idx = (word_ref.position_end, chars_line.len()); let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1]; let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
let (tail, before, after, head) = get_output_chunks(&all_before, &keyword, &all_after, &config); let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
output.push_str(&format!( output.push_str(&format!(
"{5}{0}{6}{5}{1}{6}{5}{2}{6}{5}{3}{6}{5}{4}{6}", "{5}{0}{6}{5}{1}{6}{5}{2}{6}{5}{3}{6}{5}{4}{6}",
format_tex_field(&tail), format_tex_field(&tail),
@ -515,7 +515,7 @@ fn format_tex_line(
"}" "}"
)); ));
if config.auto_ref || config.input_ref { if config.auto_ref || config.input_ref {
output.push_str(&format!("{}{}{}", "{", format_tex_field(&reference), "}")); output.push_str(&format!("{}{}{}", "{", format_tex_field(reference), "}"));
} }
output output
} }
@ -546,7 +546,7 @@ fn format_roff_line(
let keyword = &line[word_ref.position..word_ref.position_end]; let keyword = &line[word_ref.position..word_ref.position_end];
let after_chars_trim_idx = (word_ref.position_end, chars_line.len()); let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1]; let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
let (tail, before, after, head) = get_output_chunks(&all_before, &keyword, &all_after, &config); let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
output.push_str(&format!( output.push_str(&format!(
" \"{}\" \"{}\" \"{}{}\" \"{}\"", " \"{}\" \"{}\" \"{}{}\" \"{}\"",
format_roff_field(&tail), format_roff_field(&tail),
@ -556,7 +556,7 @@ fn format_roff_line(
format_roff_field(&head) format_roff_field(&head)
)); ));
if config.auto_ref || config.input_ref { if config.auto_ref || config.input_ref {
output.push_str(&format!(" \"{}\"", format_roff_field(&reference))); output.push_str(&format!(" \"{}\"", format_roff_field(reference)));
} }
output output
} }