Skip to content

Commit bf9d79f

Browse files
authored
build: rust edition 2024 (#130)
1 parent 06fbd9b commit bf9d79f

17 files changed

+38
-27
lines changed

.github/workflows/clippy.yml

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jobs:
1919
~/.cargo/git/db/
2020
target/
2121
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
22+
- name: Install minimal stable with clippy and rustfmt
23+
uses: actions-rs/toolchain@v1
24+
with:
25+
profile: minimal
26+
toolchain: stable
27+
components: rustfmt, clippy
2228
- name: Run Clippy
2329
run: cargo clippy --color always --all-targets --all-features
2430
- name: Run fmt check

.github/workflows/release-plz.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
21-
- name: Install Rust toolchain
22-
uses: dtolnay/rust-toolchain@stable
21+
- name: Install minimal stable with clippy and rustfmt
22+
uses: actions-rs/toolchain@v1
23+
with:
24+
profile: minimal
25+
toolchain: stable
26+
components: rustfmt, clippy
2327
- name: Run release-plz
2428
uses: MarcoIeni/release-plz-action@v0.5
2529
env:

.github/workflows/rust.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ jobs:
3131
~/.cargo/git/db/
3232
target/
3333
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
34-
# make sure we are on rust 1.79
35-
# see https://github.com/tuffy/bitstream-io/commit/241eaed73b0cd814640ceaf01b8220e5c98927d6#commitcomment-143198388
36-
# TODO remove this once github is on a newer version of rust
37-
- name: Set up Rust
38-
run: rustup update
34+
- name: Install minimal stable with clippy and rustfmt
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
profile: minimal
38+
toolchain: stable
39+
components: rustfmt, clippy
3940
- name: Build
4041
run: cargo build --verbose
4142
- name: Run tests

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "vpin"
33
version = "0.17.4"
4-
edition = "2021"
4+
edition = "2024"
55
description = "Rust library for the virtual pinball ecosystem"
66
repository = "https://github.com/francisdb/vpin"
77
readme = "README.md"

examples/create_basic_vpx_file.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::path::Path;
22
use vpin::vpx;
3+
use vpin::vpx::VPX;
34
use vpin::vpx::color::Color;
5+
use vpin::vpx::gameitem::GameItemEnum;
46
use vpin::vpx::gameitem::bumper::Bumper;
57
use vpin::vpx::gameitem::flipper::Flipper;
6-
use vpin::vpx::gameitem::GameItemEnum;
78
use vpin::vpx::material::Material;
8-
use vpin::vpx::VPX;
99

1010
fn main() -> Result<(), Box<dyn std::error::Error>> {
1111
let mut vpx = VPX::default();

src/vpx/biff.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use encoding_rs::mem::{decode_latin1, encode_latin1_lossy};
2-
use nom::number::complete::{le_f32, le_f64, le_i16, le_i32, le_i64, le_u16, le_u32, le_u64};
32
use nom::ToUsize;
3+
use nom::number::complete::{le_f32, le_f64, le_i16, le_i32, le_i64, le_u16, le_u32, le_u64};
44
use utf16string::WStr;
55

66
use super::model::{StringEncoding, StringWithEncoding};

src/vpx/expanded.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ use image::DynamicImage;
1515
use serde::de;
1616
use serde_json::Value;
1717

18-
use super::{gameitem, read_gamedata, Version, VPX};
18+
use super::{VPX, Version, gameitem, read_gamedata};
1919

2020
use super::collection::Collection;
2121
use super::font;
2222
use super::gamedata::{GameData, GameDataJson};
2323
use super::sound;
24-
use super::sound::{read_sound, write_sound, SoundData, SoundDataJson};
24+
use super::sound::{SoundData, SoundDataJson, read_sound, write_sound};
2525
use super::version;
2626
use crate::vpx::biff::{BiffRead, BiffReader};
2727
use crate::vpx::custominfotags::CustomInfoTags;
2828
use crate::vpx::font::{FontData, FontDataJson};
29-
use crate::vpx::gameitem::primitive::Primitive;
3029
use crate::vpx::gameitem::GameItemEnum;
30+
use crate::vpx::gameitem::primitive::Primitive;
3131
use crate::vpx::image::{ImageData, ImageDataBits, ImageDataJson};
3232
use crate::vpx::jsonmodel::{collections_json, info_to_json, json_to_collections, json_to_info};
3333
use crate::vpx::lzw::{from_lzw_blocks, to_lzw_blocks};
@@ -37,7 +37,7 @@ use crate::vpx::material::{
3737
SavePhysicsMaterialJson,
3838
};
3939
use crate::vpx::model::Vertex3dNoTex2;
40-
use crate::vpx::obj::{read_obj_file, write_obj, ObjData};
40+
use crate::vpx::obj::{ObjData, read_obj_file, write_obj};
4141
use crate::vpx::renderprobe::{RenderProbeJson, RenderProbeWithGarbage};
4242
use crate::vpx::tableinfo::TableInfo;
4343

@@ -594,7 +594,7 @@ fn read_image_bmp(data: &[u8]) -> io::Result<ImageBmp> {
594594
return Err(io::Error::new(
595595
io::ErrorKind::InvalidData,
596596
format!("BMP image uses {:?}, expecting Rgb8 or Rgba8 format", other),
597-
))
597+
));
598598
}
599599
};
600600

src/vpx/gameitem.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,9 @@ fn write_with_type<T: BiffWrite>(item_type: u32, item: &T) -> Vec<u8> {
677677

678678
#[cfg(test)]
679679
mod tests {
680+
use rand::Rng;
680681
use rand::distr::{Distribution, StandardUniform};
681682
use rand::prelude::ThreadRng;
682-
use rand::Rng;
683683

684684
/// see https://github.com/rust-random/rand/issues/1573
685685
pub(crate) trait RandomOption {

src/vpx/gameitem/bumper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::vpx::json::F32WithNanInf;
33
use fake::Dummy;
44
use serde::{Deserialize, Serialize};
55

6-
use super::{vertex2d::Vertex2D, GameItem};
6+
use super::{GameItem, vertex2d::Vertex2D};
77

88
#[derive(Debug, Dummy, PartialEq)]
99
pub struct Bumper {

src/vpx/gameitem/decal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use fake::Dummy;
66
use serde::{Deserialize, Deserializer, Serialize, Serializer};
77
use serde_json::Value;
88

9-
use super::{font::Font, font::FontJson, vertex2d::Vertex2D, GameItem};
9+
use super::{GameItem, font::Font, font::FontJson, vertex2d::Vertex2D};
1010

1111
#[derive(Debug, PartialEq, Dummy, Clone)]
1212
pub enum DecalType {

src/vpx/gameitem/flipper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::vpx::biff::{self, BiffRead, BiffReader, BiffWrite};
22
use fake::Dummy;
33
use serde::{Deserialize, Deserializer, Serialize, Serializer};
44

5-
use super::{vertex2d::Vertex2D, GameItem};
5+
use super::{GameItem, vertex2d::Vertex2D};
66

77
#[derive(Debug, PartialEq, Clone, Dummy)]
88
pub struct Flipper {

src/vpx/gameitem/textbox.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ mod tests {
354354
use std::collections::HashSet;
355355

356356
use super::*;
357-
use crate::vpx::gameitem::font::{FontStyle, CHARSET_ANSI};
357+
use crate::vpx::gameitem::font::{CHARSET_ANSI, FontStyle};
358358
use pretty_assertions::assert_eq;
359359

360360
#[test]

src/vpx/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::vpx::biff::BiffReader;
3232
use crate::vpx::expanded::vpx_image_to_dynamic_image;
3333
use crate::vpx::image::ImageDataJpeg;
3434
use crate::vpx::tableinfo::read_tableinfo;
35-
use tableinfo::{write_tableinfo, TableInfo};
35+
use tableinfo::{TableInfo, write_tableinfo};
3636
use version::Version;
3737

3838
use self::biff::{BiffRead, BiffWrite, BiffWriter};

src/vpx/sound.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std::fmt;
22

3-
use crate::vpx::wav::{read_wav_header, write_wav_header, WavHeader};
3+
use crate::vpx::wav::{WavHeader, read_wav_header, write_wav_header};
44
use bytes::{BufMut, BytesMut};
55
use fake::Dummy;
66
use serde::{Deserialize, Deserializer, Serialize, Serializer};
77
use serde_json::Value;
88

99
use super::{
10-
biff::{BiffReader, BiffWriter},
1110
Version,
11+
biff::{BiffReader, BiffWriter},
1212
};
1313

1414
#[derive(Debug, PartialEq, Dummy, Clone)]

src/vpx/tableinfo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use cfb::CompoundFile;
22
use std::collections::HashMap;
33
use std::io::{Read, Seek, Write};
4-
use std::path::{Path, MAIN_SEPARATOR_STR};
4+
use std::path::{MAIN_SEPARATOR_STR, Path};
55
use utf16string::{LittleEndian, WStr, WString};
66

77
// > "/TableInfo/AuthorName",

src/vpx/version.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{
44
cmp,
55
fmt::Display,
66
io::{self, Read, Seek, Write},
7-
path::{Path, MAIN_SEPARATOR_STR},
7+
path::{MAIN_SEPARATOR_STR, Path},
88
};
99

1010
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};

tests/common/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::ffi::OsStr;
88
use std::hash::{DefaultHasher, Hash, Hasher};
99
use std::io;
1010
use std::io::{Read, Seek, Write};
11-
use std::path::{Path, PathBuf, MAIN_SEPARATOR_STR};
11+
use std::path::{MAIN_SEPARATOR_STR, Path, PathBuf};
1212
use vpin::vpx::biff::BiffReader;
1313
use vpin::vpx::lzw::from_lzw_blocks;
1414
use walkdir::WalkDir;

0 commit comments

Comments
 (0)