Update to Rust 2024
This commit is contained in:
parent
0de13cf5a9
commit
d5a505e0c6
7 changed files with 16 additions and 15 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -40,7 +40,7 @@ jobs:
|
||||||
- name: msrv
|
- name: msrv
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
# sync MSRV with docs: guide/src/guide/installation.md and Cargo.toml
|
# 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
|
target: x86_64-unknown-linux-gnu
|
||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ missing_docs = "warn"
|
||||||
rust_2018_idioms = "warn"
|
rust_2018_idioms = "warn"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/rust-lang/mdBook"
|
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]
|
[package]
|
||||||
name = "mdbook"
|
name = "mdbook"
|
||||||
|
|
|
||||||
|
|
@ -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.
|
To build the `mdbook` executable from source, you will first need to install Rust and Cargo.
|
||||||
Follow the instructions on the [Rust installation page].
|
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:
|
Once you have installed Rust, the following command can be used to build and install mdBook:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,9 +252,7 @@ fn load_summary_item<P: AsRef<Path> + Clone>(
|
||||||
) -> Result<BookItem> {
|
) -> Result<BookItem> {
|
||||||
match item {
|
match item {
|
||||||
SummaryItem::Separator => Ok(BookItem::Separator),
|
SummaryItem::Separator => Ok(BookItem::Separator),
|
||||||
SummaryItem::Link(ref link) => {
|
SummaryItem::Link(link) => load_chapter(link, src_dir, parent_names).map(BookItem::Chapter),
|
||||||
load_chapter(link, src_dir, parent_names).map(BookItem::Chapter)
|
|
||||||
}
|
|
||||||
SummaryItem::PartTitle(title) => Ok(BookItem::PartTitle(title.clone())),
|
SummaryItem::PartTitle(title) => Ok(BookItem::PartTitle(title.clone())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -611,7 +611,7 @@ fn preprocessor_should_run(
|
||||||
let key = format!("preprocessor.{}.renderers", preprocessor.name());
|
let key = format!("preprocessor.{}.renderers", preprocessor.name());
|
||||||
let renderer_name = renderer.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
|
return explicit_renderers
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(Value::as_str)
|
.filter_map(Value::as_str)
|
||||||
|
|
|
||||||
|
|
@ -1144,7 +1144,8 @@ mod tests {
|
||||||
assert!(cfg.get(key).is_none());
|
assert!(cfg.get(key).is_none());
|
||||||
|
|
||||||
let encoded_key = encode_env_var(key);
|
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();
|
cfg.update_from_env();
|
||||||
|
|
||||||
|
|
@ -1164,7 +1165,8 @@ mod tests {
|
||||||
assert!(cfg.get(key).is_none());
|
assert!(cfg.get(key).is_none());
|
||||||
|
|
||||||
let encoded_key = encode_env_var(key);
|
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();
|
cfg.update_from_env();
|
||||||
|
|
||||||
|
|
@ -1183,7 +1185,8 @@ mod tests {
|
||||||
|
|
||||||
assert_ne!(cfg.book.title, Some(should_be.clone()));
|
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();
|
cfg.update_from_env();
|
||||||
|
|
||||||
assert_eq!(cfg.book.title, Some(should_be));
|
assert_eq!(cfg.book.title, Some(should_be));
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ impl StaticFiles {
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
for static_file in &mut self.static_files {
|
for static_file in &mut self.static_files {
|
||||||
match static_file {
|
match static_file {
|
||||||
StaticFile::Builtin {
|
&mut StaticFile::Builtin {
|
||||||
ref mut filename,
|
ref mut filename,
|
||||||
ref data,
|
ref data,
|
||||||
} => {
|
} => {
|
||||||
|
|
@ -193,7 +193,7 @@ impl StaticFiles {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StaticFile::Additional {
|
&mut StaticFile::Additional {
|
||||||
ref mut filename,
|
ref mut filename,
|
||||||
ref input_location,
|
ref input_location,
|
||||||
} => {
|
} => {
|
||||||
|
|
@ -263,8 +263,8 @@ impl StaticFiles {
|
||||||
write_file(destination, filename, &data)?;
|
write_file(destination, filename, &data)?;
|
||||||
}
|
}
|
||||||
StaticFile::Additional {
|
StaticFile::Additional {
|
||||||
ref input_location,
|
input_location,
|
||||||
ref filename,
|
filename,
|
||||||
} => {
|
} => {
|
||||||
let output_location = destination.join(filename);
|
let output_location = destination.join(filename);
|
||||||
debug!(
|
debug!(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue