summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 5f4a991..e30d7d9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -98,7 +98,7 @@ pub enum Error {
/// Key contains invalid characters.
///
/// The valid characters are anything outside of ASCII,
- /// as well as `a`–`z`, `A`–`Z`, `0`-`9`, and each of `/.-*_`.
+ /// as well as `a`–`z`, `A`–`Z`, `0`–`9`, and each of `/.-*_`.
InvalidKey(Location, Box<str>),
/// Value contains a null character.
///
@@ -116,7 +116,7 @@ pub enum Error {
/// Invalid escape sequence appears in a quoted value.
InvalidEscapeSequence(Location, Box<str>),
/// Key is defined twice in a file
- DuplicateKey(Box<(Box<str>, Location, Location)>),
+ DuplicateKey(Box<str>, Location, Location),
/// Used when there is more than one error in a file.
///
/// None of the errors in the array will be [`Error::Multiple`]'s,
@@ -165,8 +165,7 @@ impl fmt::Display for Error {
f,
"{location}: invalid escape sequence {sequence:?} (try using \\\\ instead of \\ maybe?)",
),
- Self::DuplicateKey(info) => {
- let (key, loc1, loc2) = info.as_ref();
+ Self::DuplicateKey(key, loc1, loc2) => {
write!(f, "{loc2}: key {key} was already defined at {loc1}")
}
Self::Multiple(errs) => {
@@ -661,11 +660,11 @@ impl Parser {
for window in items.windows(2) {
if window[0].0 == window[1].0 {
// duplicate key
- self.nonfatal_errors.push(Error::DuplicateKey(Box::new((
+ self.nonfatal_errors.push(Error::DuplicateKey(
window[0].0.clone(),
window[0].1.defined_at.clone(),
window[1].1.defined_at.clone(),
- ))));
+ ));
}
}
check_error_vec(take(&mut self.nonfatal_errors))?;