Skip to content

Commit d8c6a80

Browse files
committed
update to Rust 2024 edition
1 parent 28fb0b2 commit d8c6a80

4 files changed

Lines changed: 24 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
- Bevy's `WindowResolution::new` function now takes `u32`s instead of `f32`s
88
- Bevy's `Color` struct has had many changes. For example, `Color::rgb` is now `Color::srgb`. Please refer to Bevy's [`Color` documentation](https://docs.rs/bevy/0.18.0/bevy/color/enum.Color.html) for the full list of associated functions and their new names.
99

10-
1110
### Improved
1211

12+
- Update to Rust 2024 edition
1313
- Update bevy from 0.12 to 0.18
1414
- Update bevy_prototype_lyon from 0.10 to 0.16
1515
- Update ron from 0.9 to 0.12

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "rusty_engine"
33
version = "6.0.0"
44
description = "Learn Rust with a simple, cross-platform, 2D game engine."
5-
edition = "2021"
5+
edition = "2024"
66
homepage = "https://github.com/CleanCut/rusty_engine"
77
repository = "https://github.com/CleanCut/rusty_engine"
88
readme = "README.md"

examples/collider.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,18 @@ fn main() {
3636
// makes using it from `cargo install rusty_engine --example collider` possible.
3737
// This takes advantage of bevy's hard-coded asset loading behavior, and may break in future
3838
// bevy versions.
39-
std::env::set_var(
40-
"CARGO_MANIFEST_DIR",
41-
std::env::var("PWD").unwrap_or_default(),
42-
);
39+
//
40+
// Safety: This is done in single-threaded code, so concurrent access isn't a problem.
41+
unsafe {
42+
std::env::set_var(
43+
"CARGO_MANIFEST_DIR",
44+
std::env::var("PWD").unwrap_or_default(),
45+
)
46+
};
4347
// Make engine logging a bit quieter since we've got console instructions we want folks to see.
44-
std::env::set_var("RUST_LOG", "error");
48+
//
49+
// Safety: This is done in single-threaded code, so concurrent access isn't a problem.
50+
unsafe { std::env::set_var("RUST_LOG", "error") };
4551
// We need an image file to work with, so the user must pass in the path of an image
4652
let args = std::env::args().skip(1).collect::<Vec<_>>();
4753
if args.len() != 1 {

examples/level_creator.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,18 @@ fn main() {
4040
// makes using it from `cargo install rusty_engine --example collider` possible.
4141
// This takes advantage of bevy's hard-coded asset loading behavior, and may break in future
4242
// bevy versions.
43-
std::env::set_var(
44-
"CARGO_MANIFEST_DIR",
45-
std::env::var("PWD").unwrap_or_default(),
46-
);
43+
//
44+
// Safety: This is done in single-threaded code, so concurrent access isn't a problem.
45+
unsafe {
46+
std::env::set_var(
47+
"CARGO_MANIFEST_DIR",
48+
std::env::var("PWD").unwrap_or_default(),
49+
)
50+
};
4751
// Make engine logging a bit quieter since we've got console instructions we want folks to see.
48-
std::env::set_var("RUST_LOG", "error");
52+
//
53+
// Safety: This is done in single-threaded code, so concurrent access isn't a problem.
54+
unsafe { std::env::set_var("RUST_LOG", "error") };
4955

5056
let mut game = Game::new();
5157

0 commit comments

Comments
 (0)