From 351670f6201d7ceabaec3e4b79e5dcf4c5048e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sat, 27 Feb 2021 16:26:02 +0200 Subject: Remove dead gen_features code --- xtask/src/codegen/gen_features.rs | 48 --------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 xtask/src/codegen/gen_features.rs (limited to 'xtask/src') diff --git a/xtask/src/codegen/gen_features.rs b/xtask/src/codegen/gen_features.rs deleted file mode 100644 index 3cf15ce02..000000000 --- a/xtask/src/codegen/gen_features.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! Generates descriptors structure for unstable feature from Unstable Book -use std::path::{Path, PathBuf}; - -use quote::quote; -use walkdir::WalkDir; -use xshell::{cmd, read_file}; - -use crate::codegen::{project_root, reformat, update, Mode, Result}; - -pub fn generate_features(mode: Mode) -> Result<()> { - if !Path::new("./target/rust").exists() { - cmd!("git clone https://github.com/rust-lang/rust ./target/rust").run()?; - } - - let contents = generate_descriptor("./target/rust/src/doc/unstable-book/src".into())?; - - let destination = project_root().join("crates/ide/src/completion/generated_features.rs"); - update(destination.as_path(), &contents, mode)?; - - Ok(()) -} - -fn generate_descriptor(src_dir: PathBuf) -> Result { - let definitions = ["language-features", "library-features"] - .iter() - .flat_map(|it| WalkDir::new(src_dir.join(it))) - .filter_map(|e| e.ok()) - .filter(|entry| { - // Get all `.md ` files - entry.file_type().is_file() && entry.path().extension().unwrap_or_default() == "md" - }) - .map(|entry| { - let path = entry.path(); - let feature_ident = path.file_stem().unwrap().to_str().unwrap().replace("-", "_"); - let doc = read_file(path).unwrap(); - - quote! { LintCompletion { label: #feature_ident, description: #doc } } - }); - - let ts = quote! { - use crate::completion::complete_attribute::LintCompletion; - - pub(super) const FEATURES: &[LintCompletion] = &[ - #(#definitions),* - ]; - }; - reformat(&ts.to_string()) -} -- cgit v1.2.3