mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Fix clippy lints again (#388)
Fixes a bunch of clippy lints and updates edition to 2021 - [x] Changelog updated / no changelog update needed
This commit is contained in:
commit
c4fac5a779
|
@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Made Vector2D::new a const function
|
- Made Vector2D::new a const function.
|
||||||
|
- The template now uses rust 2021 edition by default.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Alpha channel is now considered by `include_gfx!()` even when `transparent_colour` is absent.
|
- Alpha channel is now considered by `include_gfx!()` even when `transparent_colour` is absent.
|
||||||
|
|
|
@ -545,7 +545,7 @@ impl<I: FixedWidthUnsignedInteger, const N: usize> Display for Num<I, N> {
|
||||||
fractional = (I::one() << N) - fractional;
|
fractional = (I::one() << N) - fractional;
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(f, "{}", integral)?;
|
write!(f, "{integral}")?;
|
||||||
|
|
||||||
if fractional != I::zero() {
|
if fractional != I::zero() {
|
||||||
write!(f, ".")?;
|
write!(f, ".")?;
|
||||||
|
@ -1046,7 +1046,7 @@ mod tests {
|
||||||
fn formats_whole_numbers_correctly() {
|
fn formats_whole_numbers_correctly() {
|
||||||
let a = Num::<i32, 8>::new(-4i32);
|
let a = Num::<i32, 8>::new(-4i32);
|
||||||
|
|
||||||
assert_eq!(format!("{}", a), "-4");
|
assert_eq!(format!("{a}"), "-4");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1060,9 +1060,9 @@ mod tests {
|
||||||
let d: Num<i32, 8> = minus_one / four;
|
let d: Num<i32, 8> = minus_one / four;
|
||||||
|
|
||||||
assert_eq!(b + c, 0.into());
|
assert_eq!(b + c, 0.into());
|
||||||
assert_eq!(format!("{}", b), "1.25");
|
assert_eq!(format!("{b}"), "1.25");
|
||||||
assert_eq!(format!("{}", c), "-1.25");
|
assert_eq!(format!("{c}"), "-1.25");
|
||||||
assert_eq!(format!("{}", d), "-0.25");
|
assert_eq!(format!("{d}"), "-0.25");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "agb_image_converter"
|
name = "agb_image_converter"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
description = "Library for converting graphics for use on the Game Boy Advance"
|
description = "Library for converting graphics for use on the Game Boy Advance"
|
||||||
repository = "https://github.com/agbrs/agb"
|
repository = "https://github.com/agbrs/agb"
|
||||||
|
|
|
@ -29,8 +29,7 @@ impl FromStr for Colour {
|
||||||
fn from_str(colour: &str) -> Result<Self, Self::Err> {
|
fn from_str(colour: &str) -> Result<Self, Self::Err> {
|
||||||
if colour.len() != 6 {
|
if colour.len() != 6 {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"Expected colour to be 6 characters, got {}",
|
"Expected colour to be 6 characters, got {colour}"
|
||||||
colour
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{Colour, Colours, TileSize};
|
||||||
|
|
||||||
pub(crate) fn parse(filename: &str) -> Box<dyn Config> {
|
pub(crate) fn parse(filename: &str) -> Box<dyn Config> {
|
||||||
let config_toml =
|
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");
|
let config: ConfigV1 = toml::from_str(&config_toml).expect("Failed to parse file");
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ pub fn include_aseprite_inner(input: TokenStream) -> TokenStream {
|
||||||
let direction = tag.animation_direction() as usize;
|
let direction = tag.animation_direction() as usize;
|
||||||
|
|
||||||
let name = tag.name();
|
let name = tag.name();
|
||||||
assert!(start <= end, "Tag {} has start > end", name);
|
assert!(start <= end, "Tag {name} has start > end");
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
(#name, Tag::new(SPRITES, #start, #end, #direction))
|
(#name, Tag::new(SPRITES, #start, #end, #direction))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "agb_macros"
|
name = "agb_macros"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
description = "Macro for declaring the entry point for a game using the agb library"
|
description = "Macro for declaring the entry point for a game using the agb library"
|
||||||
repository = "https://github.com/agbrs/agb"
|
repository = "https://github.com/agbrs/agb"
|
||||||
|
|
|
@ -116,7 +116,7 @@ pub fn num(input: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
fn hashed_ident<T: Hash>(f: &T) -> Ident {
|
fn hashed_ident<T: Hash>(f: &T) -> Ident {
|
||||||
let hash = calculate_hash(f);
|
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: Hash>(t: &T) -> u64 {
|
fn calculate_hash<T: Hash>(t: &T) -> u64 {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "agb_sound_converter"
|
name = "agb_sound_converter"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
description = "Library for converting wavs for use on the Game Boy Advance"
|
description = "Library for converting wavs for use on the Game Boy Advance"
|
||||||
repository = "https://github.com/agbrs/agb"
|
repository = "https://github.com/agbrs/agb"
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub fn include_wav(input: TokenStream) -> TokenStream {
|
||||||
let include_path = path.to_string_lossy();
|
let include_path = path.to_string_lossy();
|
||||||
|
|
||||||
let wav_reader = hound::WavReader::open(&path)
|
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<u8> = samples_from_reader(wav_reader).collect();
|
let samples: Vec<u8> = samples_from_reader(wav_reader).collect();
|
||||||
let samples = ByteString(&samples);
|
let samples = ByteString(&samples);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "pong"
|
name = "pong"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ Then replace the `name` field in `Cargo.toml` with `pong`, to end up with someth
|
||||||
name = "pong"
|
name = "pong"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Your name here"]
|
authors = ["Your name here"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
```
|
```
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "hyperspace-roll"
|
name = "hyperspace-roll"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = [""]
|
authors = [""]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "the-hat-chooses-the-wizard"
|
name = "the-hat-chooses-the-wizard"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Corwin Kuiper <corwin@kuiper.dev>", "Gwilym Kuiper <gw@ilym.me>"]
|
authors = ["Corwin Kuiper <corwin@kuiper.dev>", "Gwilym Kuiper <gw@ilym.me>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ mod tiled_export {
|
||||||
"Slime Spawn" => slimes.push((x, y)),
|
"Slime Spawn" => slimes.push((x, y)),
|
||||||
"Player Start" => player_start = Some((x, y)),
|
"Player Start" => player_start = Some((x, y)),
|
||||||
"Enemy Stop" => enemy_stops.push((x, y)),
|
"Enemy Stop" => enemy_stops.push((x, y)),
|
||||||
_ => panic!("Unknown object type {}", object_type),
|
_ => panic!("Unknown object type {object_type}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "the-purple-night"
|
name = "the-purple-night"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Corwin Kuiper <corwin@kuiper.dev>", "Gwilym Kuiper <gw@ilym.me>", "Sam Williams"]
|
authors = ["Corwin Kuiper <corwin@kuiper.dev>", "Gwilym Kuiper <gw@ilym.me>", "Sam Williams"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "mgba-test-runner"
|
name = "mgba-test-runner"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Corwin Kuiper <corwin@kuiper.dev>"]
|
authors = ["Corwin Kuiper <corwin@kuiper.dev>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "agb_template"
|
name = "agb_template"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = [""]
|
authors = [""]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
eprintln!("Error: {:?}", e);
|
eprintln!("Error: {e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue