Fix minor clippy lints

pull/166/head
Wilfred Hughes 2022-03-16 22:42:31 +07:00
parent d709aa98b5
commit f4f12003cb
7 changed files with 13 additions and 13 deletions

@ -60,7 +60,7 @@ impl Hunk {
deduped_lines.push((
if lhs_is_dupe { None } else { lhs_line },
if rhs_is_dupe { None } else { rhs_line },
))
));
}
Hunk {

@ -48,8 +48,8 @@ fn merge_novel<'a>(
for (kind, lhs_lines, rhs_lines) in lines {
match kind {
TextChangeKind::Novel => {
lhs_novel.extend(lhs_lines.iter().cloned());
rhs_novel.extend(rhs_lines.iter().cloned());
lhs_novel.extend(lhs_lines.iter().copied());
rhs_novel.extend(rhs_lines.iter().copied());
}
TextChangeKind::Unchanged => {
if !lhs_novel.is_empty() || !rhs_novel.is_empty() {

@ -14,7 +14,7 @@ use std::{
pub struct LineNumber(pub usize);
impl LineNumber {
pub fn one_indexed(&self) -> usize {
pub fn one_indexed(self) -> usize {
self.0 + 1
}
}

@ -40,7 +40,7 @@ use mimalloc::MiMalloc;
/// The global allocator used by difftastic.
///
/// Diffing allocates a large amount of memory, and MiMalloc performs
/// Diffing allocates a large amount of memory, and `MiMalloc` performs
/// better.
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
@ -416,9 +416,9 @@ fn print_diff_result(
style::header(&summary.path, 1, 1, "binary", use_color, background)
);
if changed {
println!("Binary contents changed.")
println!("Binary contents changed.");
} else {
println!("No changes.")
println!("No changes.");
}
}
}
@ -428,7 +428,7 @@ fn print_diff_result(
"{}",
style::header(&summary.path, 1, 1, "binary", use_color, background)
);
println!("Binary contents changed.")
println!("Binary contents changed.");
}
}
}

@ -145,7 +145,7 @@ pub fn split_and_apply(
}
styled_parts.push(res);
part_start += byte_len(&part)
part_start += byte_len(&part);
}
styled_parts
@ -263,7 +263,7 @@ pub fn color_positions(
AtomKind::Keyword | AtomKind::Type => {
style = style.bold();
}
_ => {}
AtomKind::Normal => {}
}
}
}

@ -432,7 +432,7 @@ pub fn init_next_prev<'a>(roots: &[&'a Syntax<'a>]) {
fn init_info_single<'a>(roots: &[&'a Syntax<'a>], next_id: &mut NonZeroU32) {
set_parent(roots, None);
set_num_ancestors(roots, 0);
set_unique_id(roots, next_id)
set_unique_id(roots, next_id);
}
fn set_unique_id<'a>(nodes: &[&'a Syntax<'a>], next_id: &mut NonZeroU32) {

@ -311,7 +311,7 @@ pub fn from_language(language: guess::Language) -> TreeSitterConfig {
TreeSitterConfig {
name: "OCaml",
language,
atom_nodes: OCAML_ATOM_NODES.iter().cloned().collect(),
atom_nodes: OCAML_ATOM_NODES.iter().copied().collect(),
delimiter_tokens: (vec![("(", ")"), ("[", "]"), ("{", "}")]),
highlight_query: ts::Query::new(
language,
@ -325,7 +325,7 @@ pub fn from_language(language: guess::Language) -> TreeSitterConfig {
TreeSitterConfig {
name: "OCaml Interface",
language,
atom_nodes: OCAML_ATOM_NODES.iter().cloned().collect(),
atom_nodes: OCAML_ATOM_NODES.iter().copied().collect(),
delimiter_tokens: (vec![("(", ")"), ("[", "]"), ("{", "}")]),
highlight_query: ts::Query::new(
language,