about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/ide-assists/src/tests.rs3
-rw-r--r--crates/ide-assists/src/tests/sourcegen.rs9
-rw-r--r--crates/ide-diagnostics/src/tests.rs1
-rw-r--r--crates/ide-diagnostics/src/tests/sourcegen.rs7
-rw-r--r--crates/rust-analyzer/tests/slow-tests/main.rs5
-rw-r--r--crates/rust-analyzer/tests/slow-tests/sourcegen.rs6
-rw-r--r--crates/syntax/src/tests.rs1
-rw-r--r--crates/syntax/src/tests/ast_src.rs7
8 files changed, 7 insertions, 32 deletions
diff --git a/crates/ide-assists/src/tests.rs b/crates/ide-assists/src/tests.rs
index 249a56b4ae3..9cd66c6b3b0 100644
--- a/crates/ide-assists/src/tests.rs
+++ b/crates/ide-assists/src/tests.rs
@@ -1,5 +1,6 @@
-mod sourcegen;
 mod generated;
+#[cfg(not(feature = "in-rust-tree"))]
+mod sourcegen;
 
 use expect_test::expect;
 use hir::{db::DefDatabase, Semantics};
diff --git a/crates/ide-assists/src/tests/sourcegen.rs b/crates/ide-assists/src/tests/sourcegen.rs
index 97d5b2cbbae..070b83d3c16 100644
--- a/crates/ide-assists/src/tests/sourcegen.rs
+++ b/crates/ide-assists/src/tests/sourcegen.rs
@@ -1,12 +1,9 @@
 //! Generates `assists.md` documentation.
 
-#[cfg(not(feature = "in-rust-tree"))]
 use std::{fmt, fs, path::Path};
 
-#[cfg(not(feature = "in-rust-tree"))]
 use test_utils::project_root;
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[test]
 fn sourcegen_assists_docs() {
     let assists = Assist::collect();
@@ -63,7 +60,6 @@ r#####"
     }
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[derive(Debug)]
 struct Section {
     doc: String,
@@ -71,7 +67,6 @@ struct Section {
     after: String,
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[derive(Debug)]
 struct Assist {
     id: String,
@@ -79,7 +74,6 @@ struct Assist {
     sections: Vec<Section>,
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 impl Assist {
     fn collect() -> Vec<Assist> {
         let handlers_dir = project_root().join("crates/ide-assists/src/handlers");
@@ -144,7 +138,6 @@ impl Assist {
     }
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 impl fmt::Display for Assist {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         let _ = writeln!(
@@ -179,7 +172,6 @@ impl fmt::Display for Assist {
     }
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 fn hide_hash_comments(text: &str) -> String {
     text.split('\n') // want final newline
         .filter(|&it| !(it.starts_with("# ") || it == "#"))
@@ -187,7 +179,6 @@ fn hide_hash_comments(text: &str) -> String {
         .collect()
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 fn reveal_hash_comments(text: &str) -> String {
     text.split('\n') // want final newline
         .map(|it| {
diff --git a/crates/ide-diagnostics/src/tests.rs b/crates/ide-diagnostics/src/tests.rs
index 7cd79c7ceef..7312bca32fe 100644
--- a/crates/ide-diagnostics/src/tests.rs
+++ b/crates/ide-diagnostics/src/tests.rs
@@ -1,3 +1,4 @@
+#[cfg(not(feature = "in-rust-tree"))]
 mod sourcegen;
 
 use expect_test::Expect;
diff --git a/crates/ide-diagnostics/src/tests/sourcegen.rs b/crates/ide-diagnostics/src/tests/sourcegen.rs
index 24bf6c35894..ec6558a46ef 100644
--- a/crates/ide-diagnostics/src/tests/sourcegen.rs
+++ b/crates/ide-diagnostics/src/tests/sourcegen.rs
@@ -1,12 +1,9 @@
 //! Generates `assists.md` documentation.
 
-#[cfg(not(feature = "in-rust-tree"))]
 use std::{fmt, fs, io, path::PathBuf};
 
-#[cfg(not(feature = "in-rust-tree"))]
 use sourcegen::project_root;
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[test]
 fn sourcegen_diagnostic_docs() {
     let diagnostics = Diagnostic::collect().unwrap();
@@ -17,7 +14,6 @@ fn sourcegen_diagnostic_docs() {
     fs::write(&dst, &contents).unwrap();
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[derive(Debug)]
 struct Diagnostic {
     id: String,
@@ -25,7 +21,6 @@ struct Diagnostic {
     doc: String,
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 impl Diagnostic {
     fn collect() -> io::Result<Vec<Diagnostic>> {
         let handlers_dir = project_root().join("crates/ide-diagnostics/src/handlers");
@@ -56,7 +51,6 @@ impl Diagnostic {
     }
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 fn is_valid_diagnostic_name(diagnostic: &str) -> Result<(), String> {
     let diagnostic = diagnostic.trim();
     if diagnostic.find(char::is_whitespace).is_some() {
@@ -72,7 +66,6 @@ fn is_valid_diagnostic_name(diagnostic: &str) -> Result<(), String> {
     Ok(())
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 impl fmt::Display for Diagnostic {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         writeln!(f, "=== {}\n**Source:** {}\n{}", self.id, self.location, self.doc)
diff --git a/crates/rust-analyzer/tests/slow-tests/main.rs b/crates/rust-analyzer/tests/slow-tests/main.rs
index eef76343dc0..4cc46af1b17 100644
--- a/crates/rust-analyzer/tests/slow-tests/main.rs
+++ b/crates/rust-analyzer/tests/slow-tests/main.rs
@@ -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};
 
diff --git a/crates/rust-analyzer/tests/slow-tests/sourcegen.rs b/crates/rust-analyzer/tests/slow-tests/sourcegen.rs
index 3c1f8a304ec..e6ac018a05f 100644
--- a/crates/rust-analyzer/tests/slow-tests/sourcegen.rs
+++ b/crates/rust-analyzer/tests/slow-tests/sourcegen.rs
@@ -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)
diff --git a/crates/syntax/src/tests.rs b/crates/syntax/src/tests.rs
index ed6430f5361..58fba8cfa8f 100644
--- a/crates/syntax/src/tests.rs
+++ b/crates/syntax/src/tests.rs
@@ -1,3 +1,4 @@
+#[cfg(not(feature = "in-rust-tree"))]
 mod ast_src;
 #[cfg(not(feature = "in-rust-tree"))]
 mod sourcegen_ast;
diff --git a/crates/syntax/src/tests/ast_src.rs b/crates/syntax/src/tests/ast_src.rs
index 93959d4ed79..cf5be1c30fb 100644
--- a/crates/syntax/src/tests/ast_src.rs
+++ b/crates/syntax/src/tests/ast_src.rs
@@ -1,6 +1,5 @@
 //! Defines input for code generation process.
 
-#[cfg(not(feature = "in-rust-tree"))]
 pub(crate) struct KindsSrc<'a> {
     pub(crate) punct: &'a [(&'a str, &'a str)],
     pub(crate) keywords: &'a [&'a str],
@@ -10,7 +9,6 @@ pub(crate) struct KindsSrc<'a> {
     pub(crate) nodes: &'a [&'a str],
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 pub(crate) const KINDS_SRC: KindsSrc<'_> = KindsSrc {
     punct: &[
         (";", "SEMICOLON"),
@@ -218,7 +216,6 @@ pub(crate) const KINDS_SRC: KindsSrc<'_> = KindsSrc {
     ],
 };
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[derive(Default, Debug)]
 pub(crate) struct AstSrc {
     pub(crate) tokens: Vec<String>,
@@ -226,7 +223,6 @@ pub(crate) struct AstSrc {
     pub(crate) enums: Vec<AstEnumSrc>,
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[derive(Debug)]
 pub(crate) struct AstNodeSrc {
     pub(crate) doc: Vec<String>,
@@ -235,21 +231,18 @@ pub(crate) struct AstNodeSrc {
     pub(crate) fields: Vec<Field>,
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[derive(Debug, Eq, PartialEq)]
 pub(crate) enum Field {
     Token(String),
     Node { name: String, ty: String, cardinality: Cardinality },
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[derive(Debug, Eq, PartialEq)]
 pub(crate) enum Cardinality {
     Optional,
     Many,
 }
 
-#[cfg(not(feature = "in-rust-tree"))]
 #[derive(Debug)]
 pub(crate) struct AstEnumSrc {
     pub(crate) doc: Vec<String>,