mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Move cfg attrs up to the mod definitions to disable sourcegen
This commit is contained in:
parent
0bffdf2627
commit
b351e115d6
8 changed files with 7 additions and 32 deletions
|
@ -10,10 +10,11 @@
|
|||
|
||||
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
|
||||
|
||||
#[cfg(not(feature = "in-rust-tree"))]
|
||||
mod sourcegen;
|
||||
mod tidy;
|
||||
mod testdir;
|
||||
mod support;
|
||||
mod testdir;
|
||||
mod tidy;
|
||||
|
||||
use std::{collections::HashMap, path::PathBuf, time::Instant};
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
//! Generates `assists.md` documentation.
|
||||
|
||||
#[cfg(not(feature = "in-rust-tree"))]
|
||||
use std::{fmt, fs, io, path::PathBuf};
|
||||
|
||||
#[cfg(not(feature = "in-rust-tree"))]
|
||||
#[test]
|
||||
fn sourcegen_feature_docs() {
|
||||
let features = Feature::collect().unwrap();
|
||||
|
@ -19,7 +17,6 @@ fn sourcegen_feature_docs() {
|
|||
fs::write(&dst, &contents).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "in-rust-tree"))]
|
||||
#[derive(Debug)]
|
||||
struct Feature {
|
||||
id: String,
|
||||
|
@ -27,7 +24,6 @@ struct Feature {
|
|||
doc: String,
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "in-rust-tree"))]
|
||||
impl Feature {
|
||||
fn collect() -> io::Result<Vec<Feature>> {
|
||||
let crates_dir = sourcegen::project_root().join("crates");
|
||||
|
@ -58,7 +54,6 @@ impl Feature {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "in-rust-tree"))]
|
||||
fn is_valid_feature_name(feature: &str) -> Result<(), String> {
|
||||
'word: for word in feature.split_whitespace() {
|
||||
for short in ["to", "and"] {
|
||||
|
@ -78,7 +73,6 @@ fn is_valid_feature_name(feature: &str) -> Result<(), String> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "in-rust-tree"))]
|
||||
impl fmt::Display for Feature {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
writeln!(f, "=== {}\n**Source:** {}\n{}", self.id, self.location, self.doc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue