From: Matt Corallo Date: Fri, 24 Apr 2020 20:24:25 +0000 (-0400) Subject: Silence fuzz build unused import warnings X-Git-Tag: v0.0.12~74^2~2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=2e997d758fc6669df8a5a9ecd7a9a82943a2b8f1;p=rust-lightning Silence fuzz build unused import warnings --- diff --git a/fuzz/src/bin/chanmon_consistency_target.rs b/fuzz/src/bin/chanmon_consistency_target.rs index 845503da1..ff082497a 100644 --- a/fuzz/src/bin/chanmon_consistency_target.rs +++ b/fuzz/src/bin/chanmon_consistency_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::chanmon_consistency::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); chanmon_consistency_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/chanmon_deser_target.rs b/fuzz/src/bin/chanmon_deser_target.rs index 1677721b2..45df25199 100644 --- a/fuzz/src/bin/chanmon_deser_target.rs +++ b/fuzz/src/bin/chanmon_deser_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::chanmon_deser::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); chanmon_deser_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/full_stack_target.rs b/fuzz/src/bin/full_stack_target.rs index 94da2888f..7ad5d148e 100644 --- a/fuzz/src/bin/full_stack_target.rs +++ b/fuzz/src/bin/full_stack_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::full_stack::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); full_stack_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_accept_channel_target.rs b/fuzz/src/bin/msg_accept_channel_target.rs index f7bfc10d0..dcd799af3 100644 --- a/fuzz/src/bin/msg_accept_channel_target.rs +++ b/fuzz/src/bin/msg_accept_channel_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_accept_channel::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_accept_channel_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_announcement_signatures_target.rs b/fuzz/src/bin/msg_announcement_signatures_target.rs index 63c6407eb..60124e928 100644 --- a/fuzz/src/bin/msg_announcement_signatures_target.rs +++ b/fuzz/src/bin/msg_announcement_signatures_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_announcement_signatures::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_announcement_signatures_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_channel_announcement_target.rs b/fuzz/src/bin/msg_channel_announcement_target.rs index 8aae27702..c20a62a3f 100644 --- a/fuzz/src/bin/msg_channel_announcement_target.rs +++ b/fuzz/src/bin/msg_channel_announcement_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_channel_announcement::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_channel_announcement_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_channel_reestablish_target.rs b/fuzz/src/bin/msg_channel_reestablish_target.rs index fb5e4774b..99301da6b 100644 --- a/fuzz/src/bin/msg_channel_reestablish_target.rs +++ b/fuzz/src/bin/msg_channel_reestablish_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_channel_reestablish::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_channel_reestablish_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_channel_update_target.rs b/fuzz/src/bin/msg_channel_update_target.rs index 78c6404f3..2ccc1e3fa 100644 --- a/fuzz/src/bin/msg_channel_update_target.rs +++ b/fuzz/src/bin/msg_channel_update_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_channel_update::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_channel_update_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_closing_signed_target.rs b/fuzz/src/bin/msg_closing_signed_target.rs index 97b49ca8d..5e676be39 100644 --- a/fuzz/src/bin/msg_closing_signed_target.rs +++ b/fuzz/src/bin/msg_closing_signed_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_closing_signed::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_closing_signed_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_commitment_signed_target.rs b/fuzz/src/bin/msg_commitment_signed_target.rs index a343e45f7..c37f0030e 100644 --- a/fuzz/src/bin/msg_commitment_signed_target.rs +++ b/fuzz/src/bin/msg_commitment_signed_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_commitment_signed::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_commitment_signed_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs b/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs index 26e26fac9..ae025cc68 100644 --- a/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs +++ b/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_decoded_onion_error_packet::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_decoded_onion_error_packet_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_error_message_target.rs b/fuzz/src/bin/msg_error_message_target.rs index 34facca3f..a72fe5333 100644 --- a/fuzz/src/bin/msg_error_message_target.rs +++ b/fuzz/src/bin/msg_error_message_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_error_message::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_error_message_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_funding_created_target.rs b/fuzz/src/bin/msg_funding_created_target.rs index 602f99067..4e885b646 100644 --- a/fuzz/src/bin/msg_funding_created_target.rs +++ b/fuzz/src/bin/msg_funding_created_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_funding_created::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_funding_created_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_funding_locked_target.rs b/fuzz/src/bin/msg_funding_locked_target.rs index ee44753de..0dc343c67 100644 --- a/fuzz/src/bin/msg_funding_locked_target.rs +++ b/fuzz/src/bin/msg_funding_locked_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_funding_locked::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_funding_locked_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_funding_signed_target.rs b/fuzz/src/bin/msg_funding_signed_target.rs index d61da65fa..0fb951035 100644 --- a/fuzz/src/bin/msg_funding_signed_target.rs +++ b/fuzz/src/bin/msg_funding_signed_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_funding_signed::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_funding_signed_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_init_target.rs b/fuzz/src/bin/msg_init_target.rs index 62b4e4159..707305231 100644 --- a/fuzz/src/bin/msg_init_target.rs +++ b/fuzz/src/bin/msg_init_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_init::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_init_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_node_announcement_target.rs b/fuzz/src/bin/msg_node_announcement_target.rs index 4605f9495..1a5484169 100644 --- a/fuzz/src/bin/msg_node_announcement_target.rs +++ b/fuzz/src/bin/msg_node_announcement_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_node_announcement::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_node_announcement_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_onion_hop_data_target.rs b/fuzz/src/bin/msg_onion_hop_data_target.rs index 1dcb5c7d5..75a5c19c2 100644 --- a/fuzz/src/bin/msg_onion_hop_data_target.rs +++ b/fuzz/src/bin/msg_onion_hop_data_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_onion_hop_data::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_onion_hop_data_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_open_channel_target.rs b/fuzz/src/bin/msg_open_channel_target.rs index 96fed7f33..f5843b7c3 100644 --- a/fuzz/src/bin/msg_open_channel_target.rs +++ b/fuzz/src/bin/msg_open_channel_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_open_channel::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_open_channel_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_ping_target.rs b/fuzz/src/bin/msg_ping_target.rs index cf2cacf2d..b0dd707ea 100644 --- a/fuzz/src/bin/msg_ping_target.rs +++ b/fuzz/src/bin/msg_ping_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_ping::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_ping_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_pong_target.rs b/fuzz/src/bin/msg_pong_target.rs index c538d1383..6f9ae4e06 100644 --- a/fuzz/src/bin/msg_pong_target.rs +++ b/fuzz/src/bin/msg_pong_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_pong::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_pong_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_revoke_and_ack_target.rs b/fuzz/src/bin/msg_revoke_and_ack_target.rs index 08fe92a2a..dcf3e99f8 100644 --- a/fuzz/src/bin/msg_revoke_and_ack_target.rs +++ b/fuzz/src/bin/msg_revoke_and_ack_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_revoke_and_ack::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_revoke_and_ack_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_shutdown_target.rs b/fuzz/src/bin/msg_shutdown_target.rs index 647e7cc7b..cb6f4e8d7 100644 --- a/fuzz/src/bin/msg_shutdown_target.rs +++ b/fuzz/src/bin/msg_shutdown_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_shutdown::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_shutdown_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_update_add_htlc_target.rs b/fuzz/src/bin/msg_update_add_htlc_target.rs index abb749a68..b4b9bc9f3 100644 --- a/fuzz/src/bin/msg_update_add_htlc_target.rs +++ b/fuzz/src/bin/msg_update_add_htlc_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_update_add_htlc::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_add_htlc_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_update_fail_htlc_target.rs b/fuzz/src/bin/msg_update_fail_htlc_target.rs index 278df1fe8..557c22912 100644 --- a/fuzz/src/bin/msg_update_fail_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fail_htlc_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_update_fail_htlc::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_fail_htlc_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs b/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs index 8c6b1e998..c62aa7633 100644 --- a/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_update_fail_malformed_htlc::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_fail_malformed_htlc_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_update_fee_target.rs b/fuzz/src/bin/msg_update_fee_target.rs index 2b01b2b6b..887843a65 100644 --- a/fuzz/src/bin/msg_update_fee_target.rs +++ b/fuzz/src/bin/msg_update_fee_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_update_fee::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_fee_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/msg_update_fulfill_htlc_target.rs b/fuzz/src/bin/msg_update_fulfill_htlc_target.rs index dbe56d7b5..1f9d9c910 100644 --- a/fuzz/src/bin/msg_update_fulfill_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fulfill_htlc_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::msg_targets::msg_update_fulfill_htlc::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_fulfill_htlc_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/peer_crypt_target.rs b/fuzz/src/bin/peer_crypt_target.rs index f68eaf1b2..b30c33ab2 100644 --- a/fuzz/src/bin/peer_crypt_target.rs +++ b/fuzz/src/bin/peer_crypt_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::peer_crypt::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); peer_crypt_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/router_target.rs b/fuzz/src/bin/router_target.rs index 8ab074b58..588c811c6 100644 --- a/fuzz/src/bin/router_target.rs +++ b/fuzz/src/bin/router_target.rs @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::router::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); router_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc}; diff --git a/fuzz/src/bin/target_template.txt b/fuzz/src/bin/target_template.txt index ae2130a9c..2dcf22712 100644 --- a/fuzz/src/bin/target_template.txt +++ b/fuzz/src/bin/target_template.txt @@ -6,9 +6,6 @@ extern crate lightning_fuzz; use lightning_fuzz::TARGET_MOD::*; -use std::fs; -use std::io::Read; - #[cfg(feature = "afl")] #[macro_use] extern crate afl; #[cfg(feature = "afl")] @@ -38,6 +35,8 @@ fuzz_target!(|data: &[u8]| { #[cfg(feature = "stdin_fuzz")] fn main() { + use std::io::Read; + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); TARGET_NAME_run(data.as_ptr(), data.len()); @@ -45,6 +44,8 @@ fn main() { #[test] fn run_test_cases() { + use std::fs; + use std::io::Read; use lightning_fuzz::utils::test_logger::StringBuffer; use std::sync::{atomic, Arc};