diff --git a/parser/src/parser.rs b/parser/src/parser.rs index e1f1b56..ea234f6 100644 --- a/parser/src/parser.rs +++ b/parser/src/parser.rs @@ -54,7 +54,7 @@ pub enum Event { /// The anchor ID the alias refers to. usize, ), - /// Value, style, anchor_id, tag + /// Value, style, `anchor_id`, tag Scalar(String, TScalarStyle, usize, Option), /// The start of a YAML sequence (array). SequenceStart( diff --git a/parser/src/scanner.rs b/parser/src/scanner.rs index c3df929..f3d418b 100644 --- a/parser/src/scanner.rs +++ b/parser/src/scanner.rs @@ -313,6 +313,7 @@ struct Indent { /// consume/push a character. As of now, almost all lookaheads are 4 characters maximum, except: /// - Escape sequences parsing: some escape codes are 8 characters /// - Scanning indent in scalars: this looks ahead `indent + 2` characters +/// /// This constant must be set to at least 8. When scanning indent in scalars, the lookahead is done /// in a single call if and only if the indent is `BUFFER_LEN - 2` or less. If the indent is higher /// than that, the code will fall back to a loop of lookaheads. @@ -1140,12 +1141,12 @@ impl> Scanner { self.scan_tag_shorthand_suffix(false, is_secondary_handle, "", &start_mark)?; } else { suffix = self.scan_tag_shorthand_suffix(false, false, &handle, &start_mark)?; - handle = "!".to_owned(); + "!".clone_into(&mut handle); // A special case: the '!' tag. Set the handle to '' and the // suffix to '!'. if suffix.is_empty() { handle.clear(); - suffix = "!".to_owned(); + "!".clone_into(&mut suffix); } } } diff --git a/parser/tests/spec_test.rs b/parser/tests/spec_test.rs index 4cffbc0..bdf36b0 100644 --- a/parser/tests/spec_test.rs +++ b/parser/tests/spec_test.rs @@ -5,7 +5,7 @@ extern crate saphyr_parser; use saphyr_parser::{Event, EventReceiver, Parser, TScalarStyle}; // These names match the names used in the C++ test suite. -#[cfg_attr(feature = "cargo-clippy", allow(clippy::enum_variant_names))] +#[allow(clippy::enum_variant_names)] #[derive(Clone, PartialEq, PartialOrd, Debug)] enum TestEvent { OnDocumentStart, diff --git a/parser/tools/time_parse.rs b/parser/tools/time_parse.rs index 02778bd..24cb875 100644 --- a/parser/tools/time_parse.rs +++ b/parser/tools/time_parse.rs @@ -1,11 +1,11 @@ -use std::env; -use std::fs::File; -use std::io::prelude::*; use saphyr_parser::{ parser::{MarkedEventReceiver, Parser}, scanner::Marker, Event, }; +use std::env; +use std::fs::File; +use std::io::prelude::*; /// A sink which discards any event sent. struct NullSink {}