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:
Gwilym Kuiper 2023-02-07 20:44:45 +00:00 committed by GitHub
commit c4fac5a779
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 24 additions and 24 deletions

View file

@ -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.

View file

@ -545,7 +545,7 @@ impl<I: FixedWidthUnsignedInteger, const N: usize> Display for Num<I, N> {
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::<i32, 8>::new(-4i32);
assert_eq!(format!("{}", a), "-4");
assert_eq!(format!("{a}"), "-4");
}
#[test]
@ -1060,9 +1060,9 @@ mod tests {
let d: Num<i32, 8> = 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]

View file

@ -2,7 +2,7 @@
name = "agb_image_converter"
version = "0.13.0"
authors = ["Gwilym Kuiper <gw@ilym.me>"]
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"

View file

@ -29,8 +29,7 @@ impl FromStr for Colour {
fn from_str(colour: &str) -> Result<Self, Self::Err> {
if colour.len() != 6 {
return Err(format!(
"Expected colour to be 6 characters, got {}",
colour
"Expected colour to be 6 characters, got {colour}"
));
}

View file

@ -6,7 +6,7 @@ use crate::{Colour, Colours, TileSize};
pub(crate) fn parse(filename: &str) -> Box<dyn Config> {
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");

View file

@ -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))

View file

@ -2,7 +2,7 @@
name = "agb_macros"
version = "0.13.0"
authors = ["Gwilym Kuiper <gw@ilym.me>"]
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"

View file

@ -116,7 +116,7 @@ pub fn num(input: TokenStream) -> TokenStream {
fn hashed_ident<T: Hash>(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: Hash>(t: &T) -> u64 {

View file

@ -2,7 +2,7 @@
name = "agb_sound_converter"
version = "0.13.0"
authors = ["Gwilym Kuiper <gw@ilym.me>"]
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"

View file

@ -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<u8> = samples_from_reader(wav_reader).collect();
let samples = ByteString(&samples);

View file

@ -2,7 +2,7 @@
name = "pong"
version = "0.1.0"
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

View file

@ -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"
# ...
```

View file

@ -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

View file

@ -2,7 +2,7 @@
name = "the-hat-chooses-the-wizard"
version = "0.1.0"
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

View file

@ -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}"),
}
}

View file

@ -2,7 +2,7 @@
name = "the-purple-night"
version = "0.1.0"
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

View file

@ -2,7 +2,7 @@
name = "mgba-test-runner"
version = "0.1.0"
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

View file

@ -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

View file

@ -35,7 +35,7 @@ fn main() {
};
if let Err(e) = result {
eprintln!("Error: {:?}", e);
eprintln!("Error: {e:?}");
}
}