From 98fe09f26bb2a332b56a9098e1bae49cf0a51eb4 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 12 May 2017 22:09:47 -0400 Subject: [PATCH] Fix lints and things that make clippy sad (#199) --- justfile | 2 +- src/integration.rs | 6 ++++-- src/lib.rs | 11 ++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/justfile b/justfile index 364bd5c..045b64c 100644 --- a/justfile +++ b/justfile @@ -104,7 +104,7 @@ sloc: echo Checking for FIXME/TODO... ! grep --color -En 'FIXME|TODO' src/*.rs echo Checking for long lines... - ! grep --color -En '.{100}' src/*.rs + ! grep --color -En '.{101}' src/*.rs nop: diff --git a/src/integration.rs b/src/integration.rs index 1fe32d7..c13d4d9 100644 --- a/src/integration.rs +++ b/src/integration.rs @@ -953,7 +953,8 @@ integration_test! { justfile: "bar:\n\t\techo hello\n\t echo goodbye", args: (), stdout: "", - stderr: "error: Recipe line has inconsistent leading whitespace. Recipe started with `␉␉` but found line with `␉␠` + stderr: "error: Recipe line has inconsistent leading whitespace. \ + Recipe started with `␉␉` but found line with `␉␠` | 3 | echo goodbye | ^ @@ -1236,7 +1237,8 @@ integration_test! { justfile: "b: a\na FOO:", args: ("b"), stdout: "", - stderr: "error: Recipe `b` depends on `a` which requires arguments. Dependencies may not require arguments + stderr: "error: Recipe `b` depends on `a` which requires arguments. \ + Dependencies may not require arguments | 1 | b: a | ^ diff --git a/src/lib.rs b/src/lib.rs index f554b97..ea4c361 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -102,7 +102,7 @@ fn empty>() -> C { iter::empty().collect() } -fn contains(range: &Range, i: T) -> bool { +fn contains(range: &Range, i: T) -> bool { i >= range.start && i < range.end } @@ -207,8 +207,8 @@ impl<'a> Display for Expression<'a> { } } -/// Return a RunError::Signal if the process was terminated by a signal, -/// otherwise return an RunError::UnknownFailure +/// Return a `RunError::Signal` if the process was terminated by a signal, +/// otherwise return an `RunError::UnknownFailure` fn error_from_signal( recipe: &str, line_number: Option, @@ -257,7 +257,7 @@ fn run_backtick<'a>( process::Stdio::inherit() }); - output(cmd).map_err(|output_error| RunError::Backtick{token: token.clone(), output_error: output_error}) + output(cmd).map_err(|output_error| RunError::Backtick{token: token.clone(), output_error}) } impl<'a> Recipe<'a> { @@ -1121,7 +1121,8 @@ impl<'a> Display for CompileError<'a> { } InconsistentLeadingWhitespace{expected, found} => { writeln!(f, - "Recipe line has inconsistent leading whitespace. Recipe started with `{}` but found line with `{}`", + "Recipe line has inconsistent leading whitespace. \ + Recipe started with `{}` but found line with `{}`", show_whitespace(expected), show_whitespace(found) )?; }