From 5ebedb67ec45ac9495a66462e1bc1e0a50673897 Mon Sep 17 00:00:00 2001 From: Simon Ask Ulsnes Date: Sat, 3 Feb 2024 10:39:04 +0100 Subject: [PATCH] More lints --- fuzz/fuzz_targets/load.rs | 4 ++-- fuzz/fuzz_targets/parse.rs | 4 ++-- fuzz/fuzz_targets/scan.rs | 2 +- tests/test_emitter.rs | 2 +- tests/test_parser.rs | 2 +- tests/test_parser_error.rs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fuzz/fuzz_targets/load.rs b/fuzz/fuzz_targets/load.rs index c818336..21ef759 100644 --- a/fuzz/fuzz_targets/load.rs +++ b/fuzz/fuzz_targets/load.rs @@ -5,9 +5,9 @@ use libyaml_safer::{ yaml_document_get_root_node, yaml_parser_load, yaml_parser_new, yaml_parser_set_input, }; -fuzz_target!(|data: &[u8]| unsafe { fuzz_target(data) }); +fuzz_target!(|data: &[u8]| fuzz_target(data)); -unsafe fn fuzz_target(mut data: &[u8]) { +fn fuzz_target(mut data: &[u8]) { let mut parser = yaml_parser_new(); yaml_parser_set_input(&mut parser, &mut data); diff --git a/fuzz/fuzz_targets/parse.rs b/fuzz/fuzz_targets/parse.rs index c1b6cb1..1e73633 100644 --- a/fuzz/fuzz_targets/parse.rs +++ b/fuzz/fuzz_targets/parse.rs @@ -3,9 +3,9 @@ use libfuzzer_sys::fuzz_target; use libyaml_safer::{yaml_parser_new, yaml_parser_parse, yaml_parser_set_input, EventData}; -fuzz_target!(|data: &[u8]| unsafe { fuzz_target(data) }); +fuzz_target!(|data: &[u8]| fuzz_target(data)); -unsafe fn fuzz_target(mut data: &[u8]) { +fn fuzz_target(mut data: &[u8]) { let mut parser = yaml_parser_new(); yaml_parser_set_input(&mut parser, &mut data); diff --git a/fuzz/fuzz_targets/scan.rs b/fuzz/fuzz_targets/scan.rs index 473b698..791697e 100644 --- a/fuzz/fuzz_targets/scan.rs +++ b/fuzz/fuzz_targets/scan.rs @@ -3,7 +3,7 @@ use libfuzzer_sys::fuzz_target; use libyaml_safer::{yaml_parser_new, yaml_parser_scan, yaml_parser_set_input, TokenData}; -fuzz_target!(|data: &[u8]| unsafe { fuzz_target(data) }); +fuzz_target!(|data: &[u8]| fuzz_target(data)); fn fuzz_target(mut data: &[u8]) { let mut parser = yaml_parser_new(); diff --git a/tests/test_emitter.rs b/tests/test_emitter.rs index 9cccd7c..a821e13 100644 --- a/tests/test_emitter.rs +++ b/tests/test_emitter.rs @@ -22,7 +22,7 @@ fn test(id: &str) { let stdout = String::from_utf8_lossy(&output.stdout); let stderr = String::from_utf8_lossy(&output.stderr); - eprint!("{}", stderr); + eprint!("{stderr}"); let out = if dir.join("out.yaml").exists() { dir.join("out.yaml") diff --git a/tests/test_parser.rs b/tests/test_parser.rs index 5b9af79..ec5c95a 100644 --- a/tests/test_parser.rs +++ b/tests/test_parser.rs @@ -22,7 +22,7 @@ fn test(id: &str) { let stdout = String::from_utf8_lossy(&output.stdout); let stderr = String::from_utf8_lossy(&output.stderr); - eprint!("{}", stderr); + eprint!("{stderr}"); let expected = fs::read_to_string(dir.join("test.event")).unwrap(); pretty_assertions::assert_str_eq!(expected, stdout); diff --git a/tests/test_parser_error.rs b/tests/test_parser_error.rs index c2ce872..c35aeca 100644 --- a/tests/test_parser_error.rs +++ b/tests/test_parser_error.rs @@ -22,8 +22,8 @@ fn test(id: &str) { if output.success { let stdout = String::from_utf8_lossy(&output.stdout); let stderr = String::from_utf8_lossy(&output.stderr); - eprint!("{}", stdout); - eprint!("{}", stderr); + eprint!("{stdout}"); + eprint!("{stderr}"); panic!("expected parse to fail"); } }