summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-12-28 19:09:31 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-12-28 19:09:32 +0100
commitf8331574d0034e08c6326513a58310b7dec153dd (patch)
tree364c0cf8ffd6d949508e3b37b6dccdf5ff37127a /src/error.rs
parent1565ca6ccf4db827c2ab56417916d977c9c4959d (diff)
Add #[must_use] annotations
Clippy nightly fails the checks because it wants us to have a `#[must_use]` annotation on functions that return `Self`. So we add these annotations with this patch. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index 84984ba..83ee416 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -114,6 +114,7 @@ impl ConfigError {
// FIXME: pub(crate)
#[doc(hidden)]
+ #[must_use]
pub fn extend_with_key(self, key: &str) -> Self {
match self {
ConfigError::Type {
@@ -132,6 +133,7 @@ impl ConfigError {
}
}
+ #[must_use]
fn prepend(self, segment: String, add_dot: bool) -> Self {
let concat = |key: Option<String>| {
let key = key.unwrap_or_else(String::new);
@@ -159,10 +161,12 @@ impl ConfigError {
}
}
+ #[must_use]
pub(crate) fn prepend_key(self, key: String) -> Self {
self.prepend(key, true)
}
+ #[must_use]
pub(crate) fn prepend_index(self, idx: usize) -> Self {
self.prepend(format!("[{}]", idx), false)
}