summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 55a407c..16329bd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -115,28 +115,25 @@ impl fmt::Display for Error {
match self {
Self::IO(message, io_err) => write!(f, "{message}: {io_err}"),
Self::IllegalCharacter(location, c) => {
- write!(f, "{location}: illegal character {}", c.escape_debug())
+ write!(f, "{location}: illegal character {c:?}")
}
Self::InvalidUtf8(location) => write!(f, "{location}: invalid UTF-8"),
Self::BadInt(location, value) => {
- write!(f, "{location}: invalid integer: {}", value.escape_debug())
+ write!(f, "{location}: invalid integer: {value:?}")
+ }
+ Self::BadUInt(location, value) => {
+ write!(f, "{location}: invalid (unsigned) integer: {value:?}",)
}
- Self::BadUInt(location, value) => write!(
- f,
- "{location}: invalid (unsigned) integer: {}",
- value.escape_debug()
- ),
Self::BadFloat(location, value) => {
- write!(f, "{location}: invalid number: {}", value.escape_debug())
+ write!(f, "{location}: invalid number: {value:?}")
}
Self::BadBool(location, value) => write!(
f,
- "{location}: value {} should be off/false/no or on/true/yes",
- value.escape_debug()
+ "{location}: value {value:?} should be off/false/no or on/true/yes",
),
Self::UnmatchedLeftBrace(location) => write!(f, "{location}: [ has no matching ]"),
Self::InvalidKey(location, key) => {
- write!(f, "{location}: invalid key {}", key.escape_debug())
+ write!(f, "{location}: invalid key {key:?}")
}
Self::InvalidValue(location) => write!(f, "{location}: value contains null characters"),
Self::InvalidLine(location) => write!(
@@ -151,8 +148,7 @@ impl fmt::Display for Error {
}
Self::InvalidEscapeSequence(location, sequence) => write!(
f,
- "{location}: invalid escape sequence {} (try using \\\\ instead of \\ maybe?)",
- sequence.escape_debug()
+ "{location}: invalid escape sequence {sequence:?} (try using \\\\ instead of \\ maybe?)",
),
Self::Multiple(errs) => {
let mut first = true;
@@ -524,8 +520,8 @@ impl Parser {
let (mut relative_key, mut value) = line
.split_once('=')
.ok_or_else(|| Error::InvalidLine(location.clone()))?;
- self.check_valid_key(&location, relative_key);
relative_key = relative_key.trim_end_matches(['\t', ' ']);
+ self.check_valid_key(&location, relative_key);
value = value.trim_start_matches(['\t', ' ']);
fn insert(