diff --git a/src/converter/ddr2osu.rs b/src/converter/ddr2osu.rs index 7964577..6f0d97d 100644 --- a/src/converter/ddr2osu.rs +++ b/src/converter/ddr2osu.rs @@ -20,7 +20,7 @@ impl ConfigRange { } impl fmt::Display for ConfigRange { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}:{}", self.0, self.1) } } @@ -89,7 +89,7 @@ pub struct ConfigMetadata { } impl fmt::Display for Config { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "ddr2osu ({}shock→{:?} hp{} acc{})", diff --git a/src/ddr/ssq.rs b/src/ddr/ssq.rs index ea523f7..0526f00 100644 --- a/src/ddr/ssq.rs +++ b/src/ddr/ssq.rs @@ -65,7 +65,7 @@ impl Into> for PlayerRow { } impl fmt::Display for PlayerRow { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{}{}{}{}", @@ -98,7 +98,7 @@ impl Into> for Row { } impl fmt::Display for Row { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let player_rows = match self { Self::Single(player_row) => vec![player_row], Self::Double(player_row1, player_row2) => vec![player_row1, player_row2], @@ -412,7 +412,7 @@ impl TryFrom for Level { } impl fmt::Display for Level { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let players = match self.players { 1 => "Single", 2 => "Double", diff --git a/src/lib.rs b/src/lib.rs index 7b7568c..93001ad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ #![warn(clippy::cast_lossless)] +#![warn(rust_2018_idioms)] #[cfg(test)] #[macro_use(quickcheck)] diff --git a/src/osu/beatmap.rs b/src/osu/beatmap.rs index 9916a14..8578e82 100644 --- a/src/osu/beatmap.rs +++ b/src/osu/beatmap.rs @@ -129,7 +129,7 @@ pub struct General { } impl fmt::Display for General { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "\ @@ -155,7 +155,7 @@ impl fmt::Display for General { pub struct Editor; impl fmt::Display for Editor { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!(f, "[Editor]") } } @@ -175,7 +175,7 @@ pub struct Metadata { } impl fmt::Display for Metadata { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "\ @@ -238,7 +238,7 @@ impl DifficultyBuilder { } impl fmt::Display for Difficulty { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "\ @@ -264,7 +264,7 @@ impl fmt::Display for Difficulty { pub struct Events(pub Vec); impl fmt::Display for Events { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "\ @@ -296,7 +296,7 @@ pub enum Event { } impl fmt::Display for Event { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Event::Background { filename, @@ -325,7 +325,7 @@ impl fmt::Display for Event { pub struct TimingPoints(pub Vec); impl fmt::Display for TimingPoints { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "\ @@ -344,7 +344,7 @@ pub struct TimingPointEffects { } impl fmt::Display for TimingPointEffects { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{}", @@ -381,7 +381,7 @@ pub struct TimingPoint { } impl fmt::Display for TimingPoint { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{},{},{},{},{},{},{},{}", @@ -401,7 +401,7 @@ impl fmt::Display for TimingPoint { pub struct Colours(pub Vec); impl fmt::Display for Colours { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "\ @@ -421,7 +421,7 @@ pub enum ColourScope { } impl fmt::Display for ColourScope { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { ColourScope::Combo(i) => write!(f, "Combo{}", i), _ => write!(f, "{:?}", self), @@ -436,7 +436,7 @@ pub struct Colour { } impl fmt::Display for Colour { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{} : {}", @@ -447,7 +447,7 @@ impl fmt::Display for Colour { } impl fmt::Display for HitSound { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{}", @@ -466,7 +466,7 @@ impl fmt::Display for HitSound { } impl fmt::Display for HitSample { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{}:{}:{}:{}:{}", @@ -483,7 +483,7 @@ impl fmt::Display for HitSample { pub struct HitObjects(pub Vec); impl fmt::Display for HitObjects { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "\ @@ -513,7 +513,7 @@ pub struct Beatmap { } impl fmt::Display for Beatmap { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "osu file format v{}\n\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}", diff --git a/src/osu/beatmap/hit_object.rs b/src/osu/beatmap/hit_object.rs index cee5331..fc7c6c8 100644 --- a/src/osu/beatmap/hit_object.rs +++ b/src/osu/beatmap/hit_object.rs @@ -84,7 +84,7 @@ impl HitObject { } impl fmt::Display for HitObject { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { HitObject::HitCircle(HitCircle { x, diff --git a/src/xact3/xwb.rs b/src/xact3/xwb.rs index e98dc96..b8d95b3 100644 --- a/src/xact3/xwb.rs +++ b/src/xact3/xwb.rs @@ -193,7 +193,7 @@ pub struct WaveBank<'a> { } impl WaveBank<'_> { - pub fn parse(data: &'_ [u8]) -> Result { + pub fn parse(data: &'_ [u8]) -> Result, Error> { debug!("Parsing header"); let header = Header::parse(mini_parser::get_slice_range(data, 0..52)?)?;