diff --git a/CHANGELOG.md b/CHANGELOG.md index 53ec8c82..c5e86550 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed -- Made Vector2D::new a const function +- Made Vector2D::new a const function. +- The template now uses rust 2021 edition by default. ### Fixed - Alpha channel is now considered by `include_gfx!()` even when `transparent_colour` is absent. diff --git a/agb-fixnum/src/lib.rs b/agb-fixnum/src/lib.rs index 43ad8698..c56de948 100644 --- a/agb-fixnum/src/lib.rs +++ b/agb-fixnum/src/lib.rs @@ -545,7 +545,7 @@ impl Display for Num { fractional = (I::one() << N) - fractional; } - write!(f, "{}", integral)?; + write!(f, "{integral}")?; if fractional != I::zero() { write!(f, ".")?; @@ -1046,7 +1046,7 @@ mod tests { fn formats_whole_numbers_correctly() { let a = Num::::new(-4i32); - assert_eq!(format!("{}", a), "-4"); + assert_eq!(format!("{a}"), "-4"); } #[test] @@ -1060,9 +1060,9 @@ mod tests { let d: Num = minus_one / four; assert_eq!(b + c, 0.into()); - assert_eq!(format!("{}", b), "1.25"); - assert_eq!(format!("{}", c), "-1.25"); - assert_eq!(format!("{}", d), "-0.25"); + assert_eq!(format!("{b}"), "1.25"); + assert_eq!(format!("{c}"), "-1.25"); + assert_eq!(format!("{d}"), "-0.25"); } #[test] diff --git a/agb-image-converter/Cargo.toml b/agb-image-converter/Cargo.toml index 640646d3..874c91ef 100644 --- a/agb-image-converter/Cargo.toml +++ b/agb-image-converter/Cargo.toml @@ -2,7 +2,7 @@ name = "agb_image_converter" version = "0.13.0" authors = ["Gwilym Kuiper "] -edition = "2018" +edition = "2021" license = "MPL-2.0" description = "Library for converting graphics for use on the Game Boy Advance" repository = "https://github.com/agbrs/agb" diff --git a/agb-image-converter/src/colour.rs b/agb-image-converter/src/colour.rs index b401b9bd..e607cadd 100644 --- a/agb-image-converter/src/colour.rs +++ b/agb-image-converter/src/colour.rs @@ -29,8 +29,7 @@ impl FromStr for Colour { fn from_str(colour: &str) -> Result { if colour.len() != 6 { return Err(format!( - "Expected colour to be 6 characters, got {}", - colour + "Expected colour to be 6 characters, got {colour}" )); } diff --git a/agb-image-converter/src/config.rs b/agb-image-converter/src/config.rs index 826b9e67..bdc498e0 100644 --- a/agb-image-converter/src/config.rs +++ b/agb-image-converter/src/config.rs @@ -6,7 +6,7 @@ use crate::{Colour, Colours, TileSize}; pub(crate) fn parse(filename: &str) -> Box { let config_toml = - fs::read_to_string(filename).unwrap_or_else(|_| panic!("Failed to read file {}", filename)); + fs::read_to_string(filename).unwrap_or_else(|_| panic!("Failed to read file {filename}")); let config: ConfigV1 = toml::from_str(&config_toml).expect("Failed to parse file"); diff --git a/agb-image-converter/src/lib.rs b/agb-image-converter/src/lib.rs index a6472f50..03800d53 100644 --- a/agb-image-converter/src/lib.rs +++ b/agb-image-converter/src/lib.rs @@ -236,7 +236,7 @@ pub fn include_aseprite_inner(input: TokenStream) -> TokenStream { let direction = tag.animation_direction() as usize; let name = tag.name(); - assert!(start <= end, "Tag {} has start > end", name); + assert!(start <= end, "Tag {name} has start > end"); quote! { (#name, Tag::new(SPRITES, #start, #end, #direction)) diff --git a/agb-macros/Cargo.toml b/agb-macros/Cargo.toml index e99e40cb..f7c8c167 100644 --- a/agb-macros/Cargo.toml +++ b/agb-macros/Cargo.toml @@ -2,7 +2,7 @@ name = "agb_macros" version = "0.13.0" authors = ["Gwilym Kuiper "] -edition = "2018" +edition = "2021" license = "MPL-2.0" description = "Macro for declaring the entry point for a game using the agb library" repository = "https://github.com/agbrs/agb" diff --git a/agb-macros/src/lib.rs b/agb-macros/src/lib.rs index a0f5f7c1..b567393d 100644 --- a/agb-macros/src/lib.rs +++ b/agb-macros/src/lib.rs @@ -116,7 +116,7 @@ pub fn num(input: TokenStream) -> TokenStream { fn hashed_ident(f: &T) -> Ident { let hash = calculate_hash(f); - Ident::new(&format!("_agb_main_func_{}", hash), Span::call_site()) + Ident::new(&format!("_agb_main_func_{hash}"), Span::call_site()) } fn calculate_hash(t: &T) -> u64 { diff --git a/agb-sound-converter/Cargo.toml b/agb-sound-converter/Cargo.toml index ad1ed104..147f4c2c 100644 --- a/agb-sound-converter/Cargo.toml +++ b/agb-sound-converter/Cargo.toml @@ -2,7 +2,7 @@ name = "agb_sound_converter" version = "0.13.0" authors = ["Gwilym Kuiper "] -edition = "2018" +edition = "2021" license = "MPL-2.0" description = "Library for converting wavs for use on the Game Boy Advance" repository = "https://github.com/agbrs/agb" diff --git a/agb-sound-converter/src/lib.rs b/agb-sound-converter/src/lib.rs index 5cbc2446..899729b1 100644 --- a/agb-sound-converter/src/lib.rs +++ b/agb-sound-converter/src/lib.rs @@ -26,7 +26,7 @@ pub fn include_wav(input: TokenStream) -> TokenStream { let include_path = path.to_string_lossy(); let wav_reader = hound::WavReader::open(&path) - .unwrap_or_else(|_| panic!("Failed to load file {}", include_path)); + .unwrap_or_else(|_| panic!("Failed to load file {include_path}")); let samples: Vec = samples_from_reader(wav_reader).collect(); let samples = ByteString(&samples); diff --git a/book/games/pong/Cargo.toml b/book/games/pong/Cargo.toml index 1ce429ba..c13ae22b 100644 --- a/book/games/pong/Cargo.toml +++ b/book/games/pong/Cargo.toml @@ -2,7 +2,7 @@ name = "pong" version = "0.1.0" authors = ["Gwilym Kuiper "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/book/src/pong/01_introduction.md b/book/src/pong/01_introduction.md index 08ce3fcc..ed272238 100644 --- a/book/src/pong/01_introduction.md +++ b/book/src/pong/01_introduction.md @@ -26,7 +26,7 @@ Then replace the `name` field in `Cargo.toml` with `pong`, to end up with someth name = "pong" version = "0.1.0" authors = ["Your name here"] -edition = "2018" +edition = "2021" # ... ``` diff --git a/examples/hyperspace-roll/Cargo.toml b/examples/hyperspace-roll/Cargo.toml index 1e7fa990..c36eee96 100644 --- a/examples/hyperspace-roll/Cargo.toml +++ b/examples/hyperspace-roll/Cargo.toml @@ -2,7 +2,7 @@ name = "hyperspace-roll" version = "0.1.0" authors = [""] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/examples/the-hat-chooses-the-wizard/Cargo.toml b/examples/the-hat-chooses-the-wizard/Cargo.toml index ce704184..3fd5fc07 100644 --- a/examples/the-hat-chooses-the-wizard/Cargo.toml +++ b/examples/the-hat-chooses-the-wizard/Cargo.toml @@ -2,7 +2,7 @@ name = "the-hat-chooses-the-wizard" version = "0.1.0" authors = ["Corwin Kuiper ", "Gwilym Kuiper "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/examples/the-hat-chooses-the-wizard/build.rs b/examples/the-hat-chooses-the-wizard/build.rs index 21e30dd2..528b7d3f 100644 --- a/examples/the-hat-chooses-the-wizard/build.rs +++ b/examples/the-hat-chooses-the-wizard/build.rs @@ -118,7 +118,7 @@ mod tiled_export { "Slime Spawn" => slimes.push((x, y)), "Player Start" => player_start = Some((x, y)), "Enemy Stop" => enemy_stops.push((x, y)), - _ => panic!("Unknown object type {}", object_type), + _ => panic!("Unknown object type {object_type}"), } } diff --git a/examples/the-purple-night/Cargo.toml b/examples/the-purple-night/Cargo.toml index 4368a0d4..82284aba 100644 --- a/examples/the-purple-night/Cargo.toml +++ b/examples/the-purple-night/Cargo.toml @@ -2,7 +2,7 @@ name = "the-purple-night" version = "0.1.0" authors = ["Corwin Kuiper ", "Gwilym Kuiper ", "Sam Williams"] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/mgba-test-runner/Cargo.toml b/mgba-test-runner/Cargo.toml index cd9f5df3..a309d884 100644 --- a/mgba-test-runner/Cargo.toml +++ b/mgba-test-runner/Cargo.toml @@ -2,7 +2,7 @@ name = "mgba-test-runner" version = "0.1.0" authors = ["Corwin Kuiper "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/template/Cargo.toml b/template/Cargo.toml index f5b657cb..d1efdf60 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -2,7 +2,7 @@ name = "agb_template" version = "0.1.0" authors = [""] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/tools/src/main.rs b/tools/src/main.rs index 79118229..999797b2 100644 --- a/tools/src/main.rs +++ b/tools/src/main.rs @@ -35,7 +35,7 @@ fn main() { }; if let Err(e) = result { - eprintln!("Error: {:?}", e); + eprintln!("Error: {e:?}"); } }