From de80253e788466c46dbb8a70e6237f8a3d3a1324 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 12 Nov 2019 01:22:55 +0100 Subject: [PATCH] Add #![warn(rust_2018_idioms)], fix warnings --- src/lib.rs | 9 +++++---- src/push_rules.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 52e86fa0..395832ef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -109,6 +109,7 @@ //! However, the `ruma_events::collections::only::Event` enum does *not* include *m.room.message*, //! because *m.room.message* implements a *more specific* event trait than `Event`. +#![warn(rust_2018_idioms)] #![deny(missing_debug_implementations, missing_docs)] // Since we support Rust 1.34.2, we can't apply this suggestion yet #![allow(clippy::use_self)] @@ -205,7 +206,7 @@ impl InvalidEvent { } impl Display for InvalidEvent { - fn fmt(&self, f: &mut Formatter) -> FmtResult { + fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { write!(f, "{}", self.message()) } } @@ -220,7 +221,7 @@ impl Error for InvalidEvent {} pub struct InvalidInput(String); impl Display for InvalidInput { - fn fmt(&self, f: &mut Formatter) -> FmtResult { + fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { write!(f, "{}", self.0) } } @@ -325,7 +326,7 @@ where pub struct FromStrError; impl Display for FromStrError { - fn fmt(&self, f: &mut Formatter) -> FmtResult { + fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { write!(f, "failed to parse type from string") } } @@ -358,7 +359,7 @@ impl<'de> Deserialize<'de> for Empty { impl<'de> Visitor<'de> for EmptyMapVisitor { type Value = Empty; - fn expecting(&self, f: &mut Formatter) -> FmtResult { + fn expecting(&self, f: &mut Formatter<'_>) -> FmtResult { write!(f, "an object/map") } diff --git a/src/push_rules.rs b/src/push_rules.rs index fa00a389..0ad7f6cd 100644 --- a/src/push_rules.rs +++ b/src/push_rules.rs @@ -198,7 +198,7 @@ impl<'de> Deserialize<'de> for Action { impl<'de> Visitor<'de> for StringOrStruct { type Value = Action; - fn expecting(&self, formatter: &mut Formatter) -> FmtResult { + fn expecting(&self, formatter: &mut Formatter<'_>) -> FmtResult { formatter.write_str("action as string or map") }