Skip to content

Commit

Permalink
Remove unused import from operations.rs tests; expose git hooks
Browse files Browse the repository at this point in the history
The git pre-commit and pre-push commit hooks weren't checking for unused
imports in tests.

I've fixed that, and exposed the pre-commit and pre-push hooks in
scripts/git-hooks
  • Loading branch information
yarrow committed Apr 19, 2023
1 parent c25e62a commit 8e21b96
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
7 changes: 7 additions & 0 deletions scripts/git-hooks/pre-commit
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
cargo fmt -- --check
cargo test -q
cargo clippy --workspace --tests --examples --no-deps
cargo clippy --profile=test
cargo clippy --profile=release --tests --examples --no-deps
9 changes: 9 additions & 0 deletions scripts/git-hooks/pre-push
@@ -0,0 +1,9 @@
#!/bin/sh
set -e
export RUSTDOCFLAGS=-Dwarnings
cargo fmt -- --check
cargo test -q
cargo clippy --workspace --tests --examples --no-deps
cargo clippy --profile=test
cargo clippy --profile=release --tests --examples --no-deps
cargo doc --workspace --no-deps --document-private-items
4 changes: 0 additions & 4 deletions src/operations.rs
Expand Up @@ -511,7 +511,6 @@ impl<Sifted: Bookkeeping, Logged: Loggable> Loggable for SiftLog<Sifted, Logged>
#[cfg(test)]
mod test {
use super::*;
use crate::operands;
use bstr::ByteSlice;
use indexmap::IndexMap;

Expand All @@ -531,8 +530,6 @@ mod test {
String::from_utf8(answer).unwrap()
}

use self::OpName::*;

#[test]
fn given_a_single_argument_all_most_ops_return_input_lines_in_order_without_dups() {
let arg: Vec<&[u8]> = vec![b"xxx\nabc\nxxx\nyyy\nxxx\nabc\n"];
Expand Down Expand Up @@ -647,7 +644,6 @@ mod test {
#[allow(clippy::pedantic)]
mod test_bookkeeping {
use super::*;
use std::fs::File;

#[test]
fn line_count_update_with_uses_saturating_increment() {
Expand Down

0 comments on commit 8e21b96

Please sign in to comment.