Skip to content

Commit d5a505e

Browse files
committed
Update to Rust 2024
1 parent 0de13cf commit d5a505e

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- name: msrv
4141
os: ubuntu-22.04
4242
# sync MSRV with docs: guide/src/guide/installation.md and Cargo.toml
43-
rust: 1.82.0
43+
rust: 1.85.0
4444
target: x86_64-unknown-linux-gnu
4545
name: ${{ matrix.name }}
4646
steps:

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ missing_docs = "warn"
1111
rust_2018_idioms = "warn"
1212

1313
[workspace.package]
14-
edition = "2021"
14+
edition = "2024"
1515
license = "MPL-2.0"
1616
repository = "https://github.com/rust-lang/mdBook"
17-
rust-version = "1.82.0" # Keep in sync with installation.md and .github/workflows/main.yml
17+
rust-version = "1.85.0" # Keep in sync with installation.md and .github/workflows/main.yml
1818

1919
[package]
2020
name = "mdbook"

guide/src/guide/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To make it easier to run, put the path to the binary into your `PATH`.
2020

2121
To build the `mdbook` executable from source, you will first need to install Rust and Cargo.
2222
Follow the instructions on the [Rust installation page].
23-
mdBook currently requires at least Rust version 1.82.
23+
mdBook currently requires at least Rust version 1.85.
2424

2525
Once you have installed Rust, the following command can be used to build and install mdBook:
2626

src/book/book.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ fn load_summary_item<P: AsRef<Path> + Clone>(
252252
) -> Result<BookItem> {
253253
match item {
254254
SummaryItem::Separator => Ok(BookItem::Separator),
255-
SummaryItem::Link(ref link) => {
256-
load_chapter(link, src_dir, parent_names).map(BookItem::Chapter)
257-
}
255+
SummaryItem::Link(link) => load_chapter(link, src_dir, parent_names).map(BookItem::Chapter),
258256
SummaryItem::PartTitle(title) => Ok(BookItem::PartTitle(title.clone())),
259257
}
260258
}

src/book/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ fn preprocessor_should_run(
611611
let key = format!("preprocessor.{}.renderers", preprocessor.name());
612612
let renderer_name = renderer.name();
613613

614-
if let Some(Value::Array(ref explicit_renderers)) = cfg.get(&key) {
614+
if let Some(Value::Array(explicit_renderers)) = cfg.get(&key) {
615615
return explicit_renderers
616616
.iter()
617617
.filter_map(Value::as_str)

src/config.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,8 @@ mod tests {
11441144
assert!(cfg.get(key).is_none());
11451145

11461146
let encoded_key = encode_env_var(key);
1147-
env::set_var(encoded_key, value);
1147+
// TODO: This is unsafe, and should be rewritten to use a process.
1148+
unsafe { env::set_var(encoded_key, value) };
11481149

11491150
cfg.update_from_env();
11501151

@@ -1164,7 +1165,8 @@ mod tests {
11641165
assert!(cfg.get(key).is_none());
11651166

11661167
let encoded_key = encode_env_var(key);
1167-
env::set_var(encoded_key, value_str);
1168+
// TODO: This is unsafe, and should be rewritten to use a process.
1169+
unsafe { env::set_var(encoded_key, value_str) };
11681170

11691171
cfg.update_from_env();
11701172

@@ -1183,7 +1185,8 @@ mod tests {
11831185

11841186
assert_ne!(cfg.book.title, Some(should_be.clone()));
11851187

1186-
env::set_var("MDBOOK_BOOK__TITLE", &should_be);
1188+
// TODO: This is unsafe, and should be rewritten to use a process.
1189+
unsafe { env::set_var("MDBOOK_BOOK__TITLE", &should_be) };
11871190
cfg.update_from_env();
11881191

11891192
assert_eq!(cfg.book.title, Some(should_be));

src/renderer/html_handlebars/static_files.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl StaticFiles {
172172
use std::io::Read;
173173
for static_file in &mut self.static_files {
174174
match static_file {
175-
StaticFile::Builtin {
175+
&mut StaticFile::Builtin {
176176
ref mut filename,
177177
ref data,
178178
} => {
@@ -193,7 +193,7 @@ impl StaticFiles {
193193
}
194194
}
195195
}
196-
StaticFile::Additional {
196+
&mut StaticFile::Additional {
197197
ref mut filename,
198198
ref input_location,
199199
} => {
@@ -263,8 +263,8 @@ impl StaticFiles {
263263
write_file(destination, filename, &data)?;
264264
}
265265
StaticFile::Additional {
266-
ref input_location,
267-
ref filename,
266+
input_location,
267+
filename,
268268
} => {
269269
let output_location = destination.join(filename);
270270
debug!(

0 commit comments

Comments
 (0)