Skip to content

Commit

Permalink
[fuzz] fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ordian committed Aug 4, 2019
1 parent de6307c commit 7722b11
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions fuzz/parse_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ extern crate toml_edit;

use toml_edit::Document;

fuzz_target!(|data| if let Ok(data) = std::str::from_utf8(data) {
let doc = data.parse::<Document>();
if let Ok(doc) = doc {
let toml = doc.to_string();
let doc = toml.parse::<Document>();
assert!(doc.is_ok());
let doc = doc.unwrap();
assert_eq!(doc.to_string(), toml);
fuzz_target!(|data| {
if let Ok(data) = std::str::from_utf8(data) {
let doc = data.parse::<Document>();
if let Ok(doc) = doc {
let toml = doc.to_string();
let doc = toml.parse::<Document>();
assert!(doc.is_ok());
let doc = doc.unwrap();
assert_eq!(doc.to_string(), toml);
}
}
});
2 changes: 1 addition & 1 deletion src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl Table {
}
}

fn visit_table(f: &mut Write, table: &Table, path: &[&str], is_array_of_tables: bool) -> Result {
fn visit_table(f: &mut dyn Write, table: &Table, path: &[&str], is_array_of_tables: bool) -> Result {
if path.is_empty() {
// don't print header for the root node
} else if is_array_of_tables {
Expand Down

0 comments on commit 7722b11

Please sign in to comment.