Clippy fixes

syntax_id
Wilfred Hughes 2023-08-15 21:42:06 +07:00
parent 6b1c82efdf
commit 191f42e9d5
1 changed files with 18 additions and 20 deletions

@ -464,20 +464,20 @@ fn diff_file_content(
None => { None => {
let file_format = FileFormat::PlainText; let file_format = FileFormat::PlainText;
if diff_options.check_only { if diff_options.check_only {
return check_only_text(&file_format, display_path, extra_info, &lhs_src, &rhs_src); return check_only_text(&file_format, display_path, extra_info, lhs_src, rhs_src);
} }
let lhs_positions = line_parser::change_positions(&lhs_src, &rhs_src); let lhs_positions = line_parser::change_positions(lhs_src, rhs_src);
let rhs_positions = line_parser::change_positions(&rhs_src, &lhs_src); let rhs_positions = line_parser::change_positions(rhs_src, lhs_src);
(file_format, lhs_positions, rhs_positions) (file_format, lhs_positions, rhs_positions)
} }
Some(ts_lang) => { Some(ts_lang) => {
let arena = Arena::new(); let arena = Arena::new();
match tsp::to_tree_with_limit(diff_options, &ts_lang, &lhs_src, &rhs_src) { match tsp::to_tree_with_limit(diff_options, &ts_lang, lhs_src, rhs_src) {
Ok((lhs_tree, rhs_tree)) => { Ok((lhs_tree, rhs_tree)) => {
match tsp::to_syntax_with_limit( match tsp::to_syntax_with_limit(
&lhs_src, lhs_src,
&rhs_src, rhs_src,
&lhs_tree, &lhs_tree,
&rhs_tree, &rhs_tree,
&arena, &arena,
@ -534,10 +534,8 @@ fn diff_file_content(
} }
if exceeded_graph_limit { if exceeded_graph_limit {
let lhs_positions = let lhs_positions = line_parser::change_positions(lhs_src, rhs_src);
line_parser::change_positions(&lhs_src, &rhs_src); let rhs_positions = line_parser::change_positions(rhs_src, lhs_src);
let rhs_positions =
line_parser::change_positions(&rhs_src, &lhs_src);
( (
FileFormat::TextFallback { FileFormat::TextFallback {
reason: "exceeded DFT_GRAPH_LIMIT".into(), reason: "exceeded DFT_GRAPH_LIMIT".into(),
@ -558,11 +556,11 @@ fn diff_file_content(
if diff_options.ignore_comments { if diff_options.ignore_comments {
let lhs_comments = let lhs_comments =
tsp::comment_positions(&lhs_tree, &lhs_src, &ts_lang); tsp::comment_positions(&lhs_tree, lhs_src, &ts_lang);
lhs_positions.extend(lhs_comments); lhs_positions.extend(lhs_comments);
let rhs_comments = let rhs_comments =
tsp::comment_positions(&rhs_tree, &rhs_src, &ts_lang); tsp::comment_positions(&rhs_tree, rhs_src, &ts_lang);
rhs_positions.extend(rhs_comments); rhs_positions.extend(rhs_comments);
} }
@ -587,13 +585,13 @@ fn diff_file_content(
&file_format, &file_format,
display_path, display_path,
extra_info, extra_info,
&lhs_src, lhs_src,
&rhs_src, rhs_src,
); );
} }
let lhs_positions = line_parser::change_positions(&lhs_src, &rhs_src); let lhs_positions = line_parser::change_positions(lhs_src, rhs_src);
let rhs_positions = line_parser::change_positions(&rhs_src, &lhs_src); let rhs_positions = line_parser::change_positions(rhs_src, lhs_src);
(file_format, lhs_positions, rhs_positions) (file_format, lhs_positions, rhs_positions)
} }
} }
@ -611,13 +609,13 @@ fn diff_file_content(
&file_format, &file_format,
display_path, display_path,
extra_info, extra_info,
&lhs_src, lhs_src,
&rhs_src, rhs_src,
); );
} }
let lhs_positions = line_parser::change_positions(&lhs_src, &rhs_src); let lhs_positions = line_parser::change_positions(lhs_src, rhs_src);
let rhs_positions = line_parser::change_positions(&rhs_src, &lhs_src); let rhs_positions = line_parser::change_positions(rhs_src, lhs_src);
(file_format, lhs_positions, rhs_positions) (file_format, lhs_positions, rhs_positions)
} }
} }