Skip to content

Commit fc6e5c7

Browse files
authored
Update to Rust 2024 edition. (#2658)
1 parent db47709 commit fc6e5c7

File tree

83 files changed

+150
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+150
-149
lines changed

.github/workflows/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ else
2525
# Back-date the sources to POT-Creation-Date. The content lives in two
2626
# directories:
2727
rm -r src/ third_party/
28-
git restore --source "$(git rev-list -n 1 --before "$pot_creation_date" @)" src/ third_party/
28+
git restore --source "$(git rev-list -n 1 --before "$pot_creation_date" @)" src/ third_party/ book.toml
2929
# Set language and adjust site URL. Clear the redirects since they are
3030
# in sync with the source files, not the translation.
3131
export MDBOOK_BOOK__LANGUAGE=$book_lang

.github/workflows/build.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ jobs:
161161
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot"}}' mdbook build -d po
162162
msgfmt -o /dev/null --statistics po/messages.pot
163163
164-
- name: Install mdbook-linkcheck
164+
- name: Install mdbook-linkcheck2
165165
if: contains(fromJSON(env.LINK_CHECKED_LANGUAGES), matrix.language)
166-
run: cargo install mdbook-linkcheck --locked --version 0.7.7
166+
run: |
167+
cargo uninstall mdbook-linkcheck || true
168+
cargo install mdbook-linkcheck2 --locked --version 0.9.1
167169
168170
- name: Build ${{ matrix.language }} translation
169171
run: |
@@ -210,6 +212,9 @@ jobs:
210212
with:
211213
fetch-depth: 0
212214

215+
- name: Update Rust
216+
run: rustup update
217+
213218
- name: Setup Rust cache
214219
uses: ./.github/workflows/setup-rust-cache
215220

.github/workflows/install-mdbook/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ runs:
1313
run: |
1414
sudo apt-get update
1515
sudo apt-get install -y texlive texlive-luatex texlive-lang-cjk texlive-lang-arabic librsvg2-bin fonts-noto
16-
curl -LsSf https://github.com/jgm/pandoc/releases/download/3.6.2/pandoc-3.6.2-linux-amd64.tar.gz | tar zxf -
17-
echo "$PWD/pandoc-3.6.2/bin" >> $GITHUB_PATH
16+
curl -LsSf https://github.com/jgm/pandoc/releases/download/3.7.0.1/pandoc-3.7.0.1-linux-amd64.tar.gz | tar zxf -
17+
echo "$PWD/pandoc-3.7.0.1/bin" >> $GITHUB_PATH
1818
shell: bash

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
with:
3636
fetch-depth: 0 # We need the full history for build.sh below.
3737

38+
- name: Update Rust
39+
run: rustup update
40+
3841
- name: Setup Rust cache
3942
uses: ./.github/workflows/setup-rust-cache
4043

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The course is built using a few tools:
5555
- [mdbook-i18n-helpers and i18n-report](https://github.com/google/mdbook-i18n-helpers)
5656
- [mdbook-exerciser](mdbook-exerciser/)
5757
- [mdbook-course](mdbook-course/)
58-
- [mdbook-linkcheck](https://github.com/Michael-F-Bryan/mdbook-linkcheck)
58+
- [mdbook-linkcheck2](https://github.com/marxin/mdbook-linkcheck2)
5959

6060
First install Rust by following the instructions on https://rustup.rs/. Then
6161
clone this repository:

book.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ src = "src"
55
title = "Comprehensive Rust 🦀"
66

77
[rust]
8-
edition = "2021"
8+
edition = "2024"
99

1010
[build]
1111
extra-watch-dirs = ["po", "third_party"]
@@ -299,3 +299,12 @@ exclude = [
299299
"comprehensive-rust-exercises.zip",
300300
# "crates.io", # uncomment when follow-web-links is true
301301
]
302+
303+
[output.linkcheck2]
304+
optional = true
305+
follow-web-links = false # change to true to check web links
306+
exclude = [
307+
"comprehensive-rust.pdf",
308+
"comprehensive-rust-exercises.zip",
309+
# "crates.io", # uncomment when follow-web-links is true
310+
]

dprint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"command": "yapf3",
1010
"exts": ["py"]
1111
}, {
12-
"command": "rustup run stable rustfmt --edition 2021",
12+
"command": "rustup run stable rustfmt --edition 2024",
1313
"exts": ["rs"]
1414
}]
1515
},

mdbook-course/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mdbook-course"
33
version = "0.1.0"
44
authors = ["Dustin Mitchell <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "Apache-2.0"
77
publish = false
88
repository = "https://github.com/google/comprehensive-rust"

mdbook-course/src/course.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
//! item becomes the first slide in that segment. Any other sub-items of the
3636
//! top-level item are treated as further slides in the same segment.
3737
38-
use crate::frontmatter::{split_frontmatter, Frontmatter};
39-
use crate::markdown::{duration, Table};
38+
use crate::frontmatter::{Frontmatter, split_frontmatter};
39+
use crate::markdown::{Table, duration};
4040
use mdbook::book::{Book, BookItem, Chapter};
4141
use std::fmt::Write;
4242
use std::path::PathBuf;
@@ -318,7 +318,9 @@ impl Session {
318318
}
319319
format!(
320320
"Including {BREAK_DURATION} minute breaks, this session should take about {}. It contains:\n\n{}",
321-
duration(self.minutes()), segments)
321+
duration(self.minutes()),
322+
segments
323+
)
322324
}
323325

324326
/// Return the total duration of this session.
@@ -337,11 +339,7 @@ impl Session {
337339
///
338340
/// This includes breaks between segments.
339341
pub fn target_minutes(&self) -> u64 {
340-
if self.target_minutes > 0 {
341-
self.target_minutes
342-
} else {
343-
self.minutes()
344-
}
342+
if self.target_minutes > 0 { self.target_minutes } else { self.minutes() }
345343
}
346344
}
347345

mdbook-exerciser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mdbook-exerciser"
33
version = "0.1.0"
44
authors = ["Andrew Walbran <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "Apache-2.0"
77
repository = "https://github.com/google/comprehensive-rust"
88
description = "A tool for extracting starter code for exercises from Markdown files."

0 commit comments

Comments
 (0)