Skip to content

Commit 5362c0f

Browse files
authored
Update to Rust 2024 edition (#843)
* Update to edition 2024 * Format using new edition rules * Fix new clippy error * Update `CHANGELOG.md`
1 parent 5b1027a commit 5362c0f

39 files changed

+151
-122
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
env:
1313
CARGO_TERM_COLOR: always
14-
MSRV: "1.82"
14+
MSRV: "1.85"
1515

1616
# Cancel any currently running workflows from the same PR, branch, or
1717
# tag when a new workflow is triggered.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4040
- `--non-interactive` may now react to key events (user input, Ctrl-C, Ctrl-R) if possible (#819)
4141
- Removed `get_` prefix from any functions which previously had it (#824)
4242
- Take elf data as bytes rather than `ElfFile` struct when creating an image format (#825)
43+
- Updated to Rust 2024 edition (#843)
4344

4445
### Fixed
4546

cargo-espflash/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "cargo-espflash"
33
version = "4.0.0-dev"
4-
edition = "2021"
5-
rust-version = "1.82"
4+
edition = "2024"
5+
rust-version = "1.85"
66
description = "Cargo subcommand for interacting with Espressif devices"
77
repository = "https://github.com/esp-rs/espflash"
88
license = "MIT OR Apache-2.0"

cargo-espflash/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# cargo-espflash
33

44
[![Crates.io](https://img.shields.io/crates/v/cargo-espflash?labelColor=1C2C2E&color=C96329&logo=Rust&style=flat-square)](https://crates.io/crates/cargo-espflash)
5-
![MSRV](https://img.shields.io/badge/MSRV-1.82-blue?labelColor=1C2C2E&logo=Rust&style=flat-square)
5+
![MSRV](https://img.shields.io/badge/MSRV-1.85-blue?labelColor=1C2C2E&logo=Rust&style=flat-square)
66
![Crates.io](https://img.shields.io/crates/l/cargo-espflash?labelColor=1C2C2E&style=flat-square)
77

88
Cross-compiler and Cargo extension for flashing Espressif devices.
@@ -25,7 +25,7 @@ Supports the **ESP32**, **ESP32-C2/C3/C6**, **ESP32-H2**, **ESP32-P4**, and **ES
2525

2626
## Installation
2727

28-
If you are installing `cargo-espflash` from source (ie. using `cargo install`) then you must have `rustc>=1.82.0` installed on your system.
28+
If you are installing `cargo-espflash` from source (ie. using `cargo install`) then you must have `rustc>=1.85.0` installed on your system.
2929

3030
To install:
3131

cargo-espflash/src/cargo_config.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,5 @@ fn config_path(path: &Path) -> Option<PathBuf> {
8989
}
9090

9191
let toml = path.join(".cargo/config.toml");
92-
if toml.exists() {
93-
Some(toml)
94-
} else {
95-
None
96-
}
92+
if toml.exists() { Some(toml) } else { None }
9793
}

cargo-espflash/src/error.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ pub enum Error {
2727
#[error("No executable artifact found")]
2828
#[diagnostic(
2929
code(cargo_espflash::no_artifact),
30-
help("If you're trying to run an example you need to specify it using the `--example` argument.\n\
31-
If you're in a Cargo workspace, specify the binary package with `--package`.")
30+
help(
31+
"If you're trying to run an example you need to specify it using the `--example` argument.\n\
32+
If you're in a Cargo workspace, specify the binary package with `--package`."
33+
)
3234
)]
3335
NoArtifact,
3436

@@ -46,8 +48,10 @@ pub enum Error {
4648
#[error("No package could be located in the current workspace")]
4749
#[diagnostic(
4850
code(cargo_espflash::no_package),
49-
help("Ensure that you are executing from a valid package, and that the specified package name \
50-
exists in the current workspace.")
51+
help(
52+
"Ensure that you are executing from a valid package, and that the specified package name \
53+
exists in the current workspace."
54+
)
5155
)]
5256
NoPackage,
5357

@@ -145,7 +149,6 @@ impl Diagnostic for NoTargetError {
145149
chip.into_target().supported_build_targets().join(", ")
146150
),
147151
None => "Specify the target in `.cargo/config.toml`".into(),
148-
}
149-
))
152+
}))
150153
}
151154
}

cargo-espflash/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use std::{
22
fs,
33
path::PathBuf,
4-
process::{exit, Command, ExitStatus, Stdio},
4+
process::{Command, ExitStatus, Stdio, exit},
55
};
66

77
use cargo_metadata::{Message, MetadataCommand};
88
use clap::{Args, CommandFactory, Parser, Subcommand};
99
use espflash::{
10+
Error as EspflashError,
1011
cli::{
1112
self,
1213
config::Config,
@@ -17,9 +18,8 @@ use espflash::{
1718
logging::initialize_logger,
1819
targets::{Chip, XtalFrequency},
1920
update::check_for_update,
20-
Error as EspflashError,
2121
};
22-
use log::{debug, info, LevelFilter};
22+
use log::{LevelFilter, debug, info};
2323
use miette::{IntoDiagnostic, Result, WrapErr};
2424

2525
use crate::{

espflash/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "espflash"
33
version = "4.0.0-dev"
4-
edition = "2021"
5-
rust-version = "1.82"
4+
edition = "2024"
5+
rust-version = "1.85"
66
description = "A command-line tool for interacting with Espressif devices"
77
repository = "https://github.com/esp-rs/espflash"
88
license = "MIT OR Apache-2.0"

espflash/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[![Crates.io](https://img.shields.io/crates/v/espflash?labelColor=1C2C2E&color=C96329&logo=Rust&style=flat-square)](https://crates.io/crates/espflash)
55
[![docs.rs](https://img.shields.io/docsrs/espflash?labelColor=1C2C2E&color=C96329&logo=rust&style=flat-square)](https://docs.rs/espflash)
6-
![MSRV](https://img.shields.io/badge/MSRV-1.82-blue?labelColor=1C2C2E&logo=Rust&style=flat-square)
6+
![MSRV](https://img.shields.io/badge/MSRV-1.85-blue?labelColor=1C2C2E&logo=Rust&style=flat-square)
77
![Crates.io](https://img.shields.io/crates/l/espflash?labelColor=1C2C2E&style=flat-square)
88

99
A library and command-line tool for flashing Espressif devices.
@@ -27,7 +27,7 @@ Supports the **ESP32**, **ESP32-C2/C3/C6**, **ESP32-H2**, **ESP32-P4**, and **ES
2727

2828
## Installation
2929

30-
If you are installing `espflash` from source (ie. using `cargo install`) then you must have `rustc>=1.82.0` installed on your system.
30+
If you are installing `espflash` from source (ie. using `cargo install`) then you must have `rustc>=1.85.0` installed on your system.
3131

3232
To install:
3333

espflash/src/bin/espflash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::{fs, path::PathBuf};
22

33
use clap::{Args, CommandFactory, Parser, Subcommand};
44
use espflash::{
5+
Error,
56
cli::{
67
self,
78
config::Config,
@@ -12,9 +13,8 @@ use espflash::{
1213
logging::initialize_logger,
1314
targets::{Chip, XtalFrequency},
1415
update::check_for_update,
15-
Error,
1616
};
17-
use log::{debug, info, LevelFilter};
17+
use log::{LevelFilter, debug, info};
1818
use miette::{IntoDiagnostic, Result, WrapErr};
1919

2020
#[derive(Debug, Parser)]

0 commit comments

Comments
 (0)