Skip to content

Commit c7b67e3

Browse files
committed
Rustfmt for 2024
1 parent d5a505e commit c7b67e3

File tree

18 files changed

+162
-103
lines changed

18 files changed

+162
-103
lines changed

examples/remove-emphasis/mdbook-remove-emphasis/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! This is a demonstration of an mdBook preprocessor which parses markdown
22
//! and removes any instances of emphasis.
33
4+
use mdbook::BookItem;
45
use mdbook::book::{Book, Chapter};
56
use mdbook::errors::Error;
67
use mdbook::preprocess::{CmdPreprocessor, Preprocessor, PreprocessorContext};
7-
use mdbook::BookItem;
88
use pulldown_cmark::{Event, Parser, Tag, TagEnd};
99
use std::io;
1010

src/book/book.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::fs::{self, File};
44
use std::io::{Read, Write};
55
use std::path::{Path, PathBuf};
66

7-
use super::summary::{parse_summary, Link, SectionNumber, Summary, SummaryItem};
7+
use super::summary::{Link, SectionNumber, Summary, SummaryItem, parse_summary};
88
use crate::config::BuildConfig;
99
use crate::errors::*;
1010
use crate::utils::bracket_escape;

src/book/mod.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ mod book;
99
mod init;
1010
mod summary;
1111

12-
pub use self::book::{load_book, Book, BookItem, BookItems, Chapter};
12+
pub use self::book::{Book, BookItem, BookItems, Chapter, load_book};
1313
pub use self::init::BookBuilder;
14-
pub use self::summary::{parse_summary, Link, SectionNumber, Summary, SummaryItem};
14+
pub use self::summary::{Link, SectionNumber, Summary, SummaryItem, parse_summary};
1515

1616
use log::{debug, error, info, log_enabled, trace, warn};
1717
use std::ffi::OsString;
@@ -817,9 +817,11 @@ mod tests {
817817

818818
let preprocessors = determine_preprocessors(&cfg).unwrap();
819819

820-
assert!(!preprocessors
821-
.iter()
822-
.any(|preprocessor| preprocessor.name() == "random"));
820+
assert!(
821+
!preprocessors
822+
.iter()
823+
.any(|preprocessor| preprocessor.name() == "random")
824+
);
823825
}
824826

825827
#[test]
@@ -836,9 +838,11 @@ mod tests {
836838

837839
let preprocessors = determine_preprocessors(&cfg).unwrap();
838840

839-
assert!(!preprocessors
840-
.iter()
841-
.any(|preprocessor| preprocessor.name() == "links"));
841+
assert!(
842+
!preprocessors
843+
.iter()
844+
.any(|preprocessor| preprocessor.name() == "links")
845+
);
842846
}
843847

844848
#[test]

src/book/summary.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,10 @@ mod tests {
776776

777777
assert!(got.is_err());
778778
let error_message = got.err().unwrap().to_string();
779-
assert_eq!(error_message, "failed to parse SUMMARY.md line 2, column 1: Suffix chapters cannot be followed by a list");
779+
assert_eq!(
780+
error_message,
781+
"failed to parse SUMMARY.md line 2, column 1: Suffix chapters cannot be followed by a list"
782+
);
780783
}
781784

782785
#[test]
@@ -788,7 +791,10 @@ mod tests {
788791

789792
assert!(got.is_err());
790793
let error_message = got.err().unwrap().to_string();
791-
assert_eq!(error_message, "failed to parse SUMMARY.md line 1, column 0: Suffix chapters cannot be followed by a list");
794+
assert_eq!(
795+
error_message,
796+
"failed to parse SUMMARY.md line 1, column 0: Suffix chapters cannot be followed by a list"
797+
);
792798
}
793799

794800
#[test]

src/cmd/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::command_prelude::*;
22
use crate::{get_book_dir, open};
3-
use mdbook::errors::Result;
43
use mdbook::MDBook;
4+
use mdbook::errors::Result;
55
use std::path::PathBuf;
66

77
// Create clap subcommand arguments

src/cmd/command_prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Helpers for building the command-line arguments for commands.
22
3-
pub use clap::{arg, Arg, ArgMatches, Command};
3+
pub use clap::{Arg, ArgMatches, Command, arg};
44
use std::path::PathBuf;
55

66
pub trait CommandExt: Sized {

src/cmd/init.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::get_book_dir;
2-
use clap::{arg, ArgMatches, Command as ClapCommand};
2+
use clap::{ArgMatches, Command as ClapCommand, arg};
3+
use mdbook::MDBook;
34
use mdbook::config;
45
use mdbook::errors::Result;
5-
use mdbook::MDBook;
66
use std::io;
77
use std::io::Write;
88
use std::process::Command;

src/cmd/serve.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ use super::command_prelude::*;
22
#[cfg(feature = "watch")]
33
use super::watch;
44
use crate::{get_book_dir, open};
5+
use axum::Router;
56
use axum::extract::ws::{Message, WebSocket, WebSocketUpgrade};
67
use axum::routing::get;
7-
use axum::Router;
88
use clap::builder::NonEmptyStringValueParser;
9-
use futures_util::sink::SinkExt;
109
use futures_util::StreamExt;
10+
use futures_util::sink::SinkExt;
11+
use mdbook::MDBook;
1112
use mdbook::errors::*;
1213
use mdbook::utils::fs::get_404_output_file;
13-
use mdbook::MDBook;
1414
use std::net::{SocketAddr, ToSocketAddrs};
1515
use std::path::PathBuf;
1616
use tokio::sync::broadcast;

src/cmd/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use super::command_prelude::*;
22
use crate::get_book_dir;
3-
use clap::builder::NonEmptyStringValueParser;
43
use clap::ArgAction;
5-
use mdbook::errors::Result;
4+
use clap::builder::NonEmptyStringValueParser;
65
use mdbook::MDBook;
6+
use mdbook::errors::Result;
77
use std::path::PathBuf;
88

99
// Create clap subcommand arguments

src/cmd/watch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::command_prelude::*;
22
use crate::{get_book_dir, open};
3-
use mdbook::errors::Result;
43
use mdbook::MDBook;
4+
use mdbook::errors::Result;
55
use std::path::{Path, PathBuf};
66

77
mod native;

0 commit comments

Comments
 (0)