Skip to content

Commit ebbc662

Browse files
Use Path/PathBuf directly instead of through path::
1 parent 7dd7c0f commit ebbc662

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Diff for: src/tools/tidy/src/unstable_book.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::collections::BTreeSet;
22
use std::fs;
3-
use std::path;
3+
use std::path::{PathBuf, Path};
44
use crate::features::{collect_lang_features, collect_lib_features, Features, Status};
55

66
pub const PATH_STR: &str = "doc/unstable-book";
@@ -12,19 +12,19 @@ pub const LANG_FEATURES_DIR: &str = "src/language-features";
1212
pub const LIB_FEATURES_DIR: &str = "src/library-features";
1313

1414
/// Builds the path to the Unstable Book source directory from the Rust 'src' directory.
15-
pub fn unstable_book_path(base_src_path: &path::Path) -> path::PathBuf {
15+
pub fn unstable_book_path(base_src_path: &Path) -> PathBuf {
1616
base_src_path.join(PATH_STR)
1717
}
1818

1919
/// Builds the path to the directory where the features are documented within the Unstable Book
2020
/// source directory.
21-
pub fn unstable_book_lang_features_path(base_src_path: &path::Path) -> path::PathBuf {
21+
pub fn unstable_book_lang_features_path(base_src_path: &Path) -> PathBuf {
2222
unstable_book_path(base_src_path).join(LANG_FEATURES_DIR)
2323
}
2424

2525
/// Builds the path to the directory where the features are documented within the Unstable Book
2626
/// source directory.
27-
pub fn unstable_book_lib_features_path(base_src_path: &path::Path) -> path::PathBuf {
27+
pub fn unstable_book_lib_features_path(base_src_path: &Path) -> PathBuf {
2828
unstable_book_path(base_src_path).join(LIB_FEATURES_DIR)
2929
}
3030

@@ -45,7 +45,7 @@ pub fn collect_unstable_feature_names(features: &Features) -> BTreeSet<String> {
4545
.collect()
4646
}
4747

48-
pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> BTreeSet<String> {
48+
pub fn collect_unstable_book_section_file_names(dir: &Path) -> BTreeSet<String> {
4949
fs::read_dir(dir)
5050
.expect("could not read directory")
5151
.map(|entry| entry.expect("could not read directory entry"))
@@ -60,7 +60,7 @@ pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> BTreeSet<St
6060
///
6161
/// * hyphens replaced by underscores,
6262
/// * the markdown suffix ('.md') removed.
63-
fn collect_unstable_book_lang_features_section_file_names(base_src_path: &path::Path)
63+
fn collect_unstable_book_lang_features_section_file_names(base_src_path: &Path)
6464
-> BTreeSet<String> {
6565
collect_unstable_book_section_file_names(&unstable_book_lang_features_path(base_src_path))
6666
}
@@ -69,12 +69,11 @@ fn collect_unstable_book_lang_features_section_file_names(base_src_path: &path::
6969
///
7070
/// * hyphens replaced by underscores,
7171
/// * the markdown suffix ('.md') removed.
72-
fn collect_unstable_book_lib_features_section_file_names(base_src_path: &path::Path)
73-
-> BTreeSet<String> {
72+
fn collect_unstable_book_lib_features_section_file_names(base_src_path: &Path) -> BTreeSet<String> {
7473
collect_unstable_book_section_file_names(&unstable_book_lib_features_path(base_src_path))
7574
}
7675

77-
pub fn check(path: &path::Path, bad: &mut bool) {
76+
pub fn check(path: &Path, bad: &mut bool) {
7877
// Library features
7978

8079
let lang_features = collect_lang_features(path, bad);

0 commit comments

Comments
 (0)