Skip to content

Commit

Permalink
Fix more clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
QuarticCat committed Sep 27, 2022
1 parent fa44d4c commit 2c6972c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/diff/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ pub fn get_set_neighbours<'syn, 'b>(
}
}
assert!(
res.len() > 0,
!res.is_empty(),
"Must always find some next steps if node is not the end"
);

Expand Down
2 changes: 1 addition & 1 deletion src/display/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub fn split_and_apply(
let end_col = span.end_col as usize;

// The remaining spans are beyond the end of this line_part.
if start_col >= part_start + byte_len(&line_part) {
if start_col >= part_start + byte_len(line_part) {
break;
}

Expand Down
11 changes: 5 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ use diff::sliders::fix_all_sliders;
use options::{DisplayMode, DisplayOptions, FileArgument, Mode, DEFAULT_TAB_WIDTH};
use owo_colors::OwoColorize;
use rayon::prelude::*;
use std::path::PathBuf;
use std::{env, path::Path};
use summary::{DiffResult, FileContent};
use syntax::init_next_prev;
Expand Down Expand Up @@ -142,7 +141,7 @@ fn main() {
print!("{}", name);

let mut extensions: Vec<&str> = (*extensions).into();
extensions.sort();
extensions.sort_unstable();

for extension in extensions {
print!(" .{}", extension);
Expand Down Expand Up @@ -179,8 +178,8 @@ fn main() {
options::FileArgument::NamedPath(rhs_path),
) if lhs_path.is_dir() && rhs_path.is_dir() => {
diff_directories(
&lhs_path,
&rhs_path,
lhs_path,
rhs_path,
&display_options,
graph_limit,
byte_limit,
Expand Down Expand Up @@ -403,8 +402,8 @@ fn diff_file_content(
/// When more than one file is modified, the hg extdiff extension passes directory
/// paths with the all the modified files.
fn diff_directories<'a>(
lhs_dir: &'a PathBuf,
rhs_dir: &'a PathBuf,
lhs_dir: &'a Path,
rhs_dir: &'a Path,
display_options: &DisplayOptions,
graph_limit: usize,
byte_limit: usize,
Expand Down
2 changes: 1 addition & 1 deletion src/parse/guess_language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn language_name(language: Language) -> &'static str {
}
}

pub const LANG_EXTENSIONS: &'static [(Language, &[&str])] = &[
pub const LANG_EXTENSIONS: &[(Language, &[&str])] = &[
(
Bash,
&[
Expand Down
2 changes: 1 addition & 1 deletion src/parse/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl<'a> Syntax<'a> {
) -> &'a Syntax<'a> {
// If a parser hasn't cleaned up \r on CRLF files with
// comments, discard it.
if content.ends_with("\r") {
if content.ends_with('\r') {
content = &content[..content.len() - 1];
}

Expand Down

0 comments on commit 2c6972c

Please sign in to comment.