Skip to content

Commit

Permalink
fix: address clippy warnings (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Sep 9, 2023
1 parent 169863e commit 63ebde2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bolero-generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl<T: TypeGenerator> Copy for TypeValueGenerator<T> {}

impl<T: TypeGenerator> Clone for TypeValueGenerator<T> {
fn clone(&self) -> Self {
Self(PhantomData)
*self
}
}

Expand Down
16 changes: 7 additions & 9 deletions bolero-generator/src/range.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{Driver, TypeGenerator, TypeGeneratorWithParams, TypeValueGenerator, ValueGenerator};

macro_rules! range_generator {
($ty:ident, $generator:ident, $new:expr) => {
($ty:ident, $generator:ident, | $start:ident, $end:ident | $new:expr) => {
pub struct $generator<Start, End> {
start: Start,
end: End,
Expand Down Expand Up @@ -61,19 +61,17 @@ macro_rules! range_generator {
type Output = core::ops::$ty<T>;

fn generate<D: Driver>(&self, driver: &mut D) -> Option<Self::Output> {
let start = self.start.generate(driver)?;
let end = self.end.generate(driver)?;
#[allow(clippy::redundant_closure)]
Some($new(start, end))
let $start = self.start.generate(driver)?;
let $end = self.end.generate(driver)?;
Some($new)
}
}

impl<T: TypeGenerator> TypeGenerator for core::ops::$ty<T> {
fn generate<D: Driver>(driver: &mut D) -> Option<Self> {
let start = driver.gen()?;
let end = driver.gen()?;
#[allow(clippy::redundant_closure)]
Some($new(start, end))
let $start = driver.gen()?;
let $end = driver.gen()?;
Some($new)
}
}

Expand Down
2 changes: 1 addition & 1 deletion bolero-kani/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub mod lib {

impl KaniEngine {
pub fn new(_location: TargetLocation) -> Self {
Self::default()
Self
}
}

Expand Down
4 changes: 3 additions & 1 deletion bolero-libfuzzer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ pub mod fuzzer {
pub fn LLVMFuzzerStartTest(a: c_int, b: *const *const c_char) -> c_int;
}

static mut TESTFN: Option<&mut dyn FnMut(&[u8]) -> bool> = None;
type TestFn<'a> = &'a mut dyn FnMut(&[u8]) -> bool;

static mut TESTFN: Option<TestFn> = None;

#[derive(Debug, Default)]
pub struct LibFuzzerEngine {
Expand Down

0 comments on commit 63ebde2

Please sign in to comment.