Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax Fn requirement, use FnOnce instead #7

Merged
merged 1 commit into from
Jun 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ extern "C" {
/// ```
#[cfg(not(fuzzing))]
#[allow(unused_variables)]
pub fn fuzz<F>(closure: F) where F: Fn(&[u8]) {
pub fn fuzz<F>(closure: F) where F: FnOnce(&[u8]) {
eprintln!("This executable hasn't been built with \"cargo hfuzz\".");
eprintln!("Try executing \"cargo hfuzz build\" and check out \"hfuzz_target\" directory.");
eprintln!("Or execute \"cargo hfuzz run TARGET\"");
Expand All @@ -249,7 +249,7 @@ lazy_static! {
}

#[cfg(all(fuzzing, not(fuzzing_debug)))]
pub fn fuzz<F>(closure: F) where F: Fn(&[u8]) + std::panic::RefUnwindSafe {
pub fn fuzz<F>(closure: F) where F: FnOnce(&[u8]) + std::panic::UnwindSafe {
// sets panic hook if not already done
lazy_static::initialize(&PANIC_HOOK);

Expand Down Expand Up @@ -278,7 +278,7 @@ pub fn fuzz<F>(closure: F) where F: Fn(&[u8]) + std::panic::RefUnwindSafe {
}

#[cfg(all(fuzzing, fuzzing_debug))]
pub fn fuzz<F>(closure: F) where F: Fn(&[u8]) {
pub fn fuzz<F>(closure: F) where F: FnOnce(&[u8]) {
use std::env;
use std::fs::File;
use memmap::MmapOptions;
Expand Down