diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-17 01:44:12 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-17 01:44:12 +0100 |
commit | 59483c217662fc5d89ef9da1cb93760e14a48418 (patch) | |
tree | cf93fa6a4f3d18e8be27acf56ee85927fd6f66c7 /xtask/src/codegen | |
parent | f0412da4a2c06e50030d13e37002d0440fc7cded (diff) | |
parent | 49a90d4c31148a6533d9ee9a288f42b454b2f421 (diff) |
Merge #6260
6260: xshell r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'xtask/src/codegen')
-rw-r--r-- | xtask/src/codegen/gen_features.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/xtask/src/codegen/gen_features.rs b/xtask/src/codegen/gen_features.rs index b58c4a0c9..3cf15ce02 100644 --- a/xtask/src/codegen/gen_features.rs +++ b/xtask/src/codegen/gen_features.rs | |||
@@ -3,15 +3,13 @@ use std::path::{Path, PathBuf}; | |||
3 | 3 | ||
4 | use quote::quote; | 4 | use quote::quote; |
5 | use walkdir::WalkDir; | 5 | use walkdir::WalkDir; |
6 | use xshell::{cmd, read_file}; | ||
6 | 7 | ||
7 | use crate::{ | 8 | use crate::codegen::{project_root, reformat, update, Mode, Result}; |
8 | codegen::{project_root, reformat, update, Mode, Result}, | ||
9 | not_bash::{fs2, run}, | ||
10 | }; | ||
11 | 9 | ||
12 | pub fn generate_features(mode: Mode) -> Result<()> { | 10 | pub fn generate_features(mode: Mode) -> Result<()> { |
13 | if !Path::new("./target/rust").exists() { | 11 | if !Path::new("./target/rust").exists() { |
14 | run!("git clone https://github.com/rust-lang/rust ./target/rust")?; | 12 | cmd!("git clone https://github.com/rust-lang/rust ./target/rust").run()?; |
15 | } | 13 | } |
16 | 14 | ||
17 | let contents = generate_descriptor("./target/rust/src/doc/unstable-book/src".into())?; | 15 | let contents = generate_descriptor("./target/rust/src/doc/unstable-book/src".into())?; |
@@ -34,7 +32,7 @@ fn generate_descriptor(src_dir: PathBuf) -> Result<String> { | |||
34 | .map(|entry| { | 32 | .map(|entry| { |
35 | let path = entry.path(); | 33 | let path = entry.path(); |
36 | let feature_ident = path.file_stem().unwrap().to_str().unwrap().replace("-", "_"); | 34 | let feature_ident = path.file_stem().unwrap().to_str().unwrap().replace("-", "_"); |
37 | let doc = fs2::read_to_string(path).unwrap(); | 35 | let doc = read_file(path).unwrap(); |
38 | 36 | ||
39 | quote! { LintCompletion { label: #feature_ident, description: #doc } } | 37 | quote! { LintCompletion { label: #feature_ident, description: #doc } } |
40 | }); | 38 | }); |