summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-12-03 15:14:38 -0500
committerGitHub <noreply@github.com>2020-12-03 15:14:38 -0500
commit15d06cbf7584570ec3b5beaba99cb8898f9ec3dc (patch)
tree1e8a4f6d3469dd7718d837dfbda8d2d7c5b4ba80
parent8e65ea071a1fdfc34d5031ce1a5130e109d7bb5e (diff)
Disable some clippy warnings (#422)
-rw-r--r--.github/workflows/ci.yml37
-rw-r--r--src/edits.rs3
-rw-r--r--src/features/line_numbers.rs1
-rw-r--r--src/features/side_by_side.rs5
-rw-r--r--src/paint.rs3
-rw-r--r--src/parse.rs1
6 files changed, 31 insertions, 19 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ed560153..bcad4b42 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -85,25 +85,24 @@ jobs:
command: fmt
args: --all -- --check
- # TODO enable this when there are no more clippy warnings:
- # clippy:
- # name: Clippy
- # runs-on: ubuntu-latest
- # steps:
- # - name: Checkout repository
- # uses: actions/checkout@v2
- # - name: Install Rust
- # uses: actions-rs/toolchain@v1
- # with:
- # toolchain: stable
- # profile: minimal
- # override: true
- # components: clippy
- # - name: Clippy Check
- # uses: actions-rs/cargo@v1
- # with:
- # command: clippy
- # args: -- -D warnings
+ clippy:
+ name: Clippy
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+ - name: Install Rust
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: stable
+ profile: minimal
+ override: true
+ components: clippy
+ - name: Clippy Check
+ uses: actions-rs/cargo@v1
+ with:
+ command: clippy
+ args: -- -D warnings
coverage:
name: Code coverage
diff --git a/src/edits.rs b/src/edits.rs
index 870ce2d3..06d934ff 100644
--- a/src/edits.rs
+++ b/src/edits.rs
@@ -12,6 +12,8 @@ use crate::align;
/// minus and plus lines. `noop_deletions[i]` is the appropriate deletion operation tag to be used
/// for `minus_lines[i]`; `noop_deletions` is guaranteed to be the same length as `minus_lines`.
/// The equivalent statements hold for `plus_insertions` and `plus_lines`.
+#[allow(clippy::too_many_arguments)]
+#[allow(clippy::type_complexity)]
pub fn infer_edits<'a, EditOperation>(
minus_lines: Vec<&'a str>,
plus_lines: Vec<&'a str>,
@@ -123,6 +125,7 @@ fn tokenize<'a>(line: &'a str, regex: &Regex) -> Vec<&'a str> {
// This function doesn't return "coalesced" annotations: i.e. they're often are runs of consecutive
// occurrences of the same operation. Since it is returning &strs pointing into the memory of the
// original line, it's not possible to coalesce them in this function.
+#[allow(clippy::type_complexity)]
fn annotate<'a, Annotation>(
alignment: align::Alignment<'a>,
noop_deletion: Annotation,
diff --git a/src/features/line_numbers.rs b/src/features/line_numbers.rs
index baa22cbd..e2edae3e 100644
--- a/src/features/line_numbers.rs
+++ b/src/features/line_numbers.rs
@@ -232,6 +232,7 @@ fn parse_line_number_format(format_string: &str) -> LineNumberFormatData {
format_data
}
+#[allow(clippy::too_many_arguments)]
fn format_and_paint_line_number_field<'a>(
format_data: &[LineNumberPlaceholderData<'a>],
style: &Style,
diff --git a/src/features/side_by_side.rs b/src/features/side_by_side.rs
index a9abfb03..805a61ac 100644
--- a/src/features/side_by_side.rs
+++ b/src/features/side_by_side.rs
@@ -59,6 +59,7 @@ impl SideBySideData {
}
/// Emit a sequence of minus and plus lines in side-by-side mode.
+#[allow(clippy::too_many_arguments)]
pub fn paint_minus_and_plus_lines_side_by_side<'a>(
minus_syntax_style_sections: Vec<Vec<(SyntectStyle, &str)>>,
minus_diff_style_sections: Vec<Vec<(Style, &str)>>,
@@ -111,6 +112,7 @@ pub fn paint_minus_and_plus_lines_side_by_side<'a>(
}
}
+#[allow(clippy::too_many_arguments)]
pub fn paint_zero_lines_side_by_side(
syntax_style_sections: Vec<Vec<(SyntectStyle, &str)>>,
diff_style_sections: Vec<Vec<(Style, &str)>>,
@@ -175,6 +177,7 @@ pub fn paint_zero_lines_side_by_side(
}
}
+#[allow(clippy::too_many_arguments)]
fn paint_left_panel_minus_line<'a>(
line_index: Option<usize>,
syntax_style_sections: &[Vec<(SyntectStyle, &str)>],
@@ -208,6 +211,7 @@ fn paint_left_panel_minus_line<'a>(
panel_line
}
+#[allow(clippy::too_many_arguments)]
fn paint_right_panel_plus_line<'a>(
line_index: Option<usize>,
syntax_style_sections: &[Vec<(SyntectStyle, &str)>],
@@ -289,6 +293,7 @@ fn get_right_fill_style_for_left_panel(
// what this will do is set the line number pair in that function to `(Some(minus_number), None)`,
// and then only emit the right field (which has a None number, i.e. blank). However, it will also
// increment the minus line number, so we need to knock that back down.
+#[allow(clippy::too_many_arguments)]
fn paint_minus_or_plus_panel_line(
line_index: Option<usize>,
syntax_style_sections: &[Vec<(SyntectStyle, &str)>],
diff --git a/src/paint.rs b/src/paint.rs
index 9171f231..7bb19f06 100644
--- a/src/paint.rs
+++ b/src/paint.rs
@@ -240,6 +240,7 @@ impl<'a> Painter<'a> {
/// Superimpose background styles and foreground syntax
/// highlighting styles, and write colored lines to output buffer.
+ #[allow(clippy::too_many_arguments)]
pub fn paint_lines(
syntax_style_sections: Vec<Vec<(SyntectStyle, &str)>>,
diff_style_sections: Vec<Vec<(Style, &str)>>,
@@ -487,6 +488,7 @@ impl<'a> Painter<'a> {
}
/// Set background styles to represent diff for minus and plus lines in buffer.
+ #[allow(clippy::type_complexity)]
fn get_diff_style_sections<'b>(
minus_lines: &'b [(String, State)],
plus_lines: &'b [(String, State)],
@@ -635,6 +637,7 @@ mod superimpose_style_sections {
exploded
}
+ #[allow(clippy::type_complexity)]
fn superimpose(
style_section_pairs: Vec<(&(SyntectStyle, char), (Style, char))>,
) -> Vec<((SyntectStyle, Style), char)> {
diff --git a/src/parse.rs b/src/parse.rs
index 7e39c772..4c2cf233 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -9,6 +9,7 @@ use crate::features;
// https://git-scm.com/docs/git-config#Documentation/git-config.txt-diffmnemonicPrefix
const DIFF_PREFIXES: [&str; 6] = ["a/", "b/", "c/", "i/", "o/", "w/"];
+#[allow(clippy::tabs_in_doc_comments)]
/// Given input like
/// "--- one.rs 2019-11-20 06:16:08.000000000 +0100"
/// Return "rs"