Update to Rust 2024

This commit is contained in:
Eric Huss
2025-07-21 10:30:43 -07:00
parent 0de13cf5a9
commit d5a505e0c6
7 changed files with 16 additions and 15 deletions

View File

@@ -40,7 +40,7 @@ jobs:
- name: msrv
os: ubuntu-22.04
# sync MSRV with docs: guide/src/guide/installation.md and Cargo.toml
rust: 1.82.0
rust: 1.85.0
target: x86_64-unknown-linux-gnu
name: ${{ matrix.name }}
steps:

View File

@@ -11,10 +11,10 @@ missing_docs = "warn"
rust_2018_idioms = "warn"
[workspace.package]
edition = "2021"
edition = "2024"
license = "MPL-2.0"
repository = "https://github.com/rust-lang/mdBook"
rust-version = "1.82.0" # Keep in sync with installation.md and .github/workflows/main.yml
rust-version = "1.85.0" # Keep in sync with installation.md and .github/workflows/main.yml
[package]
name = "mdbook"

View File

@@ -20,7 +20,7 @@ To make it easier to run, put the path to the binary into your `PATH`.
To build the `mdbook` executable from source, you will first need to install Rust and Cargo.
Follow the instructions on the [Rust installation page].
mdBook currently requires at least Rust version 1.82.
mdBook currently requires at least Rust version 1.85.
Once you have installed Rust, the following command can be used to build and install mdBook:

View File

@@ -252,9 +252,7 @@ fn load_summary_item<P: AsRef<Path> + Clone>(
) -> Result<BookItem> {
match item {
SummaryItem::Separator => Ok(BookItem::Separator),
SummaryItem::Link(ref link) => {
load_chapter(link, src_dir, parent_names).map(BookItem::Chapter)
}
SummaryItem::Link(link) => load_chapter(link, src_dir, parent_names).map(BookItem::Chapter),
SummaryItem::PartTitle(title) => Ok(BookItem::PartTitle(title.clone())),
}
}

View File

@@ -611,7 +611,7 @@ fn preprocessor_should_run(
let key = format!("preprocessor.{}.renderers", preprocessor.name());
let renderer_name = renderer.name();
if let Some(Value::Array(ref explicit_renderers)) = cfg.get(&key) {
if let Some(Value::Array(explicit_renderers)) = cfg.get(&key) {
return explicit_renderers
.iter()
.filter_map(Value::as_str)

View File

@@ -1144,7 +1144,8 @@ mod tests {
assert!(cfg.get(key).is_none());
let encoded_key = encode_env_var(key);
env::set_var(encoded_key, value);
// TODO: This is unsafe, and should be rewritten to use a process.
unsafe { env::set_var(encoded_key, value) };
cfg.update_from_env();
@@ -1164,7 +1165,8 @@ mod tests {
assert!(cfg.get(key).is_none());
let encoded_key = encode_env_var(key);
env::set_var(encoded_key, value_str);
// TODO: This is unsafe, and should be rewritten to use a process.
unsafe { env::set_var(encoded_key, value_str) };
cfg.update_from_env();
@@ -1183,7 +1185,8 @@ mod tests {
assert_ne!(cfg.book.title, Some(should_be.clone()));
env::set_var("MDBOOK_BOOK__TITLE", &should_be);
// TODO: This is unsafe, and should be rewritten to use a process.
unsafe { env::set_var("MDBOOK_BOOK__TITLE", &should_be) };
cfg.update_from_env();
assert_eq!(cfg.book.title, Some(should_be));

View File

@@ -172,7 +172,7 @@ impl StaticFiles {
use std::io::Read;
for static_file in &mut self.static_files {
match static_file {
StaticFile::Builtin {
&mut StaticFile::Builtin {
ref mut filename,
ref data,
} => {
@@ -193,7 +193,7 @@ impl StaticFiles {
}
}
}
StaticFile::Additional {
&mut StaticFile::Additional {
ref mut filename,
ref input_location,
} => {
@@ -263,8 +263,8 @@ impl StaticFiles {
write_file(destination, filename, &data)?;
}
StaticFile::Additional {
ref input_location,
ref filename,
input_location,
filename,
} => {
let output_location = destination.join(filename);
debug!(