Skip to content

Commit 66bf85b

Browse files
Dylan-DPCmgeisler
authored andcommitted
Require Rust 2021 edition
This allows us to clean up and simplify the code.
1 parent 1a08927 commit 66bf85b

File tree

22 files changed

+32
-24
lines changed

22 files changed

+32
-24
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- build: msrv
3333
os: ubuntu-latest
3434
# sync MSRV with docs: guide/src/guide/installation.md
35-
rust: 1.54.0
35+
rust: 1.56.0
3636
steps:
3737
- uses: actions/checkout@master
3838
- name: Install Rust

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = [
77
"Matt Ickstadt <mattico8@gmail.com>"
88
]
99
documentation = "http://rust-lang.github.io/mdBook/index.html"
10-
edition = "2018"
10+
edition = "2021"
1111
exclude = ["/guide/*"]
1212
keywords = ["book", "gitbook", "rustbook", "markdown"]
1313
license = "MPL-2.0"

src/book/book.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use super::summary::{parse_summary, Link, SectionNumber, Summary, SummaryItem};
88
use crate::config::BuildConfig;
99
use crate::errors::*;
1010
use crate::utils::bracket_escape;
11-
11+
use log::debug;
1212
use serde::{Deserialize, Serialize};
1313

1414
/// Load a book into memory from its `src/` directory.

src/book/init.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use super::MDBook;
66
use crate::config::Config;
77
use crate::errors::*;
88
use crate::theme;
9+
use log::{debug, error, info, trace};
910

1011
/// A helper for setting up a new book and its directory structure.
1112
#[derive(Debug, Clone, PartialEq)]

src/book/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub use self::book::{load_book, Book, BookItem, BookItems, Chapter};
1414
pub use self::init::BookBuilder;
1515
pub use self::summary::{parse_summary, Link, SectionNumber, Summary, SummaryItem};
1616

17+
use log::{debug, error, info, log_enabled, trace, warn};
1718
use std::io::Write;
1819
use std::path::PathBuf;
1920
use std::process::Command;

src/book/summary.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::errors::*;
2+
use log::{debug, trace, warn};
23
use memchr::{self, Memchr};
34
use pulldown_cmark::{self, Event, HeadingLevel, Tag};
45
use serde::{Deserialize, Serialize};

src/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
5050
#![deny(missing_docs)]
5151

52+
use log::{debug, trace, warn};
5253
use serde::{Deserialize, Deserializer, Serialize, Serializer};
5354
use std::collections::HashMap;
5455
use std::env;
@@ -295,7 +296,7 @@ impl Default for Config {
295296
}
296297
}
297298

298-
impl<'de> Deserialize<'de> for Config {
299+
impl<'de> serde::Deserialize<'de> for Config {
299300
fn deserialize<D: Deserializer<'de>>(de: D) -> std::result::Result<Self, D::Error> {
300301
let raw = Value::deserialize(de)?;
301302

@@ -717,6 +718,7 @@ impl<'de, T> Updateable<'de> for T where T: Serialize + Deserialize<'de> {}
717718
mod tests {
718719
use super::*;
719720
use crate::utils::fs::get_404_output_file;
721+
use serde_json::json;
720722

721723
const COMPLEX_CONFIG: &str = r#"
722724
[book]

src/lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,6 @@
8383
#![deny(missing_docs)]
8484
#![deny(rust_2018_idioms)]
8585

86-
#[macro_use]
87-
extern crate lazy_static;
88-
#[macro_use]
89-
extern crate log;
90-
#[macro_use]
91-
extern crate serde_json;
92-
93-
#[cfg(test)]
94-
#[macro_use]
95-
extern crate pretty_assertions;
96-
9786
pub mod book;
9887
pub mod config;
9988
pub mod preprocess;

src/preprocess/cmd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use super::{Preprocessor, PreprocessorContext};
22
use crate::book::Book;
33
use crate::errors::*;
4+
use log::{debug, trace, warn};
45
use shlex::Shlex;
56
use std::io::{self, Read, Write};
67
use std::process::{Child, Command, Stdio};

src/preprocess/index.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
use regex::Regex;
22
use std::path::Path;
33

4-
use crate::errors::*;
5-
64
use super::{Preprocessor, PreprocessorContext};
75
use crate::book::{Book, BookItem};
6+
use crate::errors::*;
7+
use lazy_static::lazy_static;
8+
use log::warn;
89

910
/// A preprocessor for converting file name `README.md` to `index.md` since
1011
/// `README.md` is the de facto index file in markdown-based documentation.

0 commit comments

Comments
 (0)