Add #![warn(rust_2018_idioms)], fix warnings

This commit is contained in:
Jonas Platte 2019-11-12 01:22:55 +01:00
parent e9d55cbfac
commit de80253e78
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 6 additions and 5 deletions

View File

@ -109,6 +109,7 @@
//! However, the `ruma_events::collections::only::Event` enum does *not* include *m.room.message*, //! 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`. //! because *m.room.message* implements a *more specific* event trait than `Event`.
#![warn(rust_2018_idioms)]
#![deny(missing_debug_implementations, missing_docs)] #![deny(missing_debug_implementations, missing_docs)]
// Since we support Rust 1.34.2, we can't apply this suggestion yet // Since we support Rust 1.34.2, we can't apply this suggestion yet
#![allow(clippy::use_self)] #![allow(clippy::use_self)]
@ -205,7 +206,7 @@ impl InvalidEvent {
} }
impl Display for InvalidEvent { impl Display for InvalidEvent {
fn fmt(&self, f: &mut Formatter) -> FmtResult { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(f, "{}", self.message()) write!(f, "{}", self.message())
} }
} }
@ -220,7 +221,7 @@ impl Error for InvalidEvent {}
pub struct InvalidInput(String); pub struct InvalidInput(String);
impl Display for InvalidInput { impl Display for InvalidInput {
fn fmt(&self, f: &mut Formatter) -> FmtResult { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(f, "{}", self.0) write!(f, "{}", self.0)
} }
} }
@ -325,7 +326,7 @@ where
pub struct FromStrError; pub struct FromStrError;
impl Display for 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") write!(f, "failed to parse type from string")
} }
} }
@ -358,7 +359,7 @@ impl<'de> Deserialize<'de> for Empty {
impl<'de> Visitor<'de> for EmptyMapVisitor { impl<'de> Visitor<'de> for EmptyMapVisitor {
type Value = Empty; type Value = Empty;
fn expecting(&self, f: &mut Formatter) -> FmtResult { fn expecting(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(f, "an object/map") write!(f, "an object/map")
} }

View File

@ -198,7 +198,7 @@ impl<'de> Deserialize<'de> for Action {
impl<'de> Visitor<'de> for StringOrStruct { impl<'de> Visitor<'de> for StringOrStruct {
type Value = Action; 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") formatter.write_str("action as string or map")
} }