Skip to content

Commit d9a70ad

Browse files
committed
style: Make clippy happy
1 parent 4f5b5af commit d9a70ad

7 files changed

Lines changed: 20 additions & 17 deletions

File tree

examples/example_fixture.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::exit)]
1+
#![allow(clippy::exit, reason = "binary needs use of exit")]
22

33
use std::env;
44
use std::error::Error;

examples/failure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[allow(clippy::wildcard_imports)] // false positive
1+
#[allow(clippy::wildcard_imports, reason = "false positive")]
22
use assert_cmd::prelude::*;
33

44
use std::process::Command;

src/assert.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ pub struct EqCodePredicate(predicates::ord::EqPredicate<i32>);
571571
impl EqCodePredicate {
572572
pub(crate) fn new(value: i32) -> Self {
573573
let pred = predicates::ord::eq(value);
574-
EqCodePredicate(pred)
574+
Self(pred)
575575
}
576576
}
577577

@@ -640,7 +640,7 @@ pub struct InCodePredicate(predicates::iter::InPredicate<i32>);
640640
impl InCodePredicate {
641641
pub(crate) fn new<I: IntoIterator<Item = i32>>(value: I) -> Self {
642642
let pred = predicates::iter::in_iter(value);
643-
InCodePredicate(pred)
643+
Self(pred)
644644
}
645645
}
646646

@@ -765,11 +765,11 @@ pub struct BytesContentOutputPredicate(Cow<'static, [u8]>);
765765

766766
impl BytesContentOutputPredicate {
767767
pub(crate) fn new(value: &'static [u8]) -> Self {
768-
BytesContentOutputPredicate(Cow::from(value))
768+
Self(Cow::from(value))
769769
}
770770

771771
pub(crate) fn from_vec(value: Vec<u8>) -> Self {
772-
BytesContentOutputPredicate(Cow::from(value))
772+
Self(Cow::from(value))
773773
}
774774
}
775775

@@ -843,12 +843,12 @@ pub struct StrContentOutputPredicate(
843843
impl StrContentOutputPredicate {
844844
pub(crate) fn from_str(value: &'static str) -> Self {
845845
let pred = predicates::str::diff(value).from_utf8();
846-
StrContentOutputPredicate(pred)
846+
Self(pred)
847847
}
848848

849849
pub(crate) fn from_string(value: String) -> Self {
850850
let pred = predicates::str::diff(value).from_utf8();
851-
StrContentOutputPredicate(pred)
851+
Self(pred)
852852
}
853853
}
854854

@@ -933,7 +933,7 @@ where
933933
{
934934
pub(crate) fn new(pred: P) -> Self {
935935
let pred = pred.from_utf8();
936-
StrOutputPredicate(pred)
936+
Self(pred)
937937
}
938938
}
939939

src/bin/bin_fixture.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::exit)]
1+
#![allow(clippy::exit, reason = "binary needs use of exit")]
22

33
use std::env;
44
use std::error::Error;

src/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ where
142142

143143
impl CommandCargoExt for crate::cmd::Command {
144144
fn cargo_bin<S: AsRef<str>>(name: S) -> Result<Self, CargoError> {
145-
crate::cmd::Command::cargo_bin(name)
145+
Self::cargo_bin(name)
146146
}
147147
}
148148

src/cmd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ impl Command {
455455
input: Option<Vec<u8>>,
456456
timeout: Option<std::time::Duration>,
457457
) -> io::Result<process::Output> {
458-
#![allow(clippy::unwrap_used)] // changes behavior in some tests
458+
#![allow(clippy::unwrap_used, reason = "changes behavior in some tests")]
459459

460460
fn read<R>(mut input: R) -> std::thread::JoinHandle<io::Result<Vec<u8>>>
461461
where
@@ -611,7 +611,7 @@ impl Command {
611611

612612
impl From<process::Command> for Command {
613613
fn from(cmd: process::Command) -> Self {
614-
Command::from_std(cmd)
614+
Self::from_std(cmd)
615615
}
616616
}
617617

src/output.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ enum OutputCause {
266266
impl fmt::Display for OutputCause {
267267
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
268268
match *self {
269-
OutputCause::Expected(ref e) => write!(f, "{e:#}"),
270-
OutputCause::Unexpected(ref e) => write!(f, "{e:#}"),
269+
Self::Expected(ref e) => write!(f, "{e:#}"),
270+
Self::Unexpected(ref e) => write!(f, "{e:#}"),
271271
}
272272
}
273273
}
@@ -331,7 +331,7 @@ pub(crate) struct DebugBuffer {
331331

332332
impl DebugBuffer {
333333
pub(crate) fn new(buffer: Vec<u8>) -> Self {
334-
DebugBuffer {
334+
Self {
335335
buffer: buffer.into(),
336336
}
337337
}
@@ -344,7 +344,10 @@ impl fmt::Display for DebugBuffer {
344344
}
345345

346346
fn format_bytes(data: &[u8], f: &mut impl fmt::Write) -> fmt::Result {
347-
#![allow(clippy::assertions_on_constants)]
347+
#![allow(
348+
clippy::assertions_on_constants,
349+
reason = "enforce constant relationships on edit"
350+
)]
348351

349352
const LINES_MIN_OVERFLOW: usize = 80;
350353
const LINES_MAX_START: usize = 20;

0 commit comments

Comments
 (0)