Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #12871 - fasterthanlime:sync-from-rust-2, r=Veykril
Sync from `rust-lang/rust` This is the first subtree sync PR from `rust-lang/rust` to `rust-lang/rust-analyzer`, made by following the instructions at: https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html#performing-the-sync-from-rust-langrust-to-clippy It includes all the commits that were made in: * https://github.com/rust-lang/rust/pull/99603 (And that were reviewed ahead of time by `@Veykril` + `@lnicola)`
bors 2022-07-25
parent ac86b8e · parent dc94050 · commit 0b1ed70
-rw-r--r--.gitattributes3
-rw-r--r--crates/hir-def/src/import_map.rs80
-rw-r--r--crates/hir-def/src/nameres.rs9
-rw-r--r--crates/hir-def/src/nameres/tests.rs20
-rw-r--r--crates/hir-def/src/nameres/tests/globs.rs18
-rw-r--r--crates/hir-def/src/nameres/tests/macros.rs23
-rw-r--r--crates/ide-assists/Cargo.toml3
-rw-r--r--crates/ide-assists/src/tests.rs3
-rw-r--r--crates/ide-assists/src/tests/sourcegen.rs7
-rw-r--r--crates/ide-diagnostics/Cargo.toml3
-rw-r--r--crates/ide-diagnostics/src/tests.rs1
-rw-r--r--crates/ide/Cargo.toml3
-rw-r--r--crates/proc-macro-test/build.rs11
-rw-r--r--crates/rust-analyzer/Cargo.toml7
-rw-r--r--crates/rust-analyzer/tests/slow-tests/main.rs5
-rw-r--r--crates/rust-analyzer/tests/slow-tests/tidy.rs7
-rw-r--r--crates/sourcegen/Cargo.toml3
-rw-r--r--crates/syntax/Cargo.toml3
-rw-r--r--crates/syntax/src/tests.rs4
-rw-r--r--crates/syntax/test_data/parser/validation/0045_ambiguous_trait_object.rs12
-rw-r--r--crates/syntax/test_data/parser/validation/0046_mutable_const_item.rs2
-rw-r--r--crates/syntax/test_data/parser/validation/invalid_let_expr.rast432
-rw-r--r--crates/test-utils/src/lib.rs7
23 files changed, 357 insertions, 309 deletions
diff --git a/.gitattributes b/.gitattributes
index 3b3d2d0d65..cb87b5d013 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,7 +1,8 @@
* text=auto eol=lf
+
# git grep shouldn't match entries in this benchmark data
bench_data/** binary
-crates/syntax/test_data/** -text eof=LF
+
# Older git versions try to fix line endings on images, this prevents it.
*.png binary
*.jpg binary
diff --git a/crates/hir-def/src/import_map.rs b/crates/hir-def/src/import_map.rs
index 000fe5ac7b..05e0ceb05a 100644
--- a/crates/hir-def/src/import_map.rs
+++ b/crates/hir-def/src/import_map.rs
@@ -516,6 +516,9 @@ mod tests {
mark
))
})
+ // HashSet iteration order isn't defined - it's different on
+ // x86_64 and i686 at the very least
+ .sorted()
.collect::<String>();
expect.assert_eq(&actual)
}
@@ -588,6 +591,7 @@ mod tests {
Some(format!("{}:\n{:?}\n", name, map))
})
+ .sorted()
.collect::<String>();
expect.assert_eq(&actual)
@@ -621,15 +625,15 @@ mod tests {
struct Priv;
",
expect![[r#"
+ lib:
+ - Pub (t)
+ - Pub2 (t)
+ - Pub2 (v)
main:
- publ1 (t)
- real_pu2 (t)
- real_pub (t)
- real_pub::Pub (t)
- lib:
- - Pub (t)
- - Pub2 (t)
- - Pub2 (v)
"#]],
);
}
@@ -671,13 +675,13 @@ mod tests {
pub struct S;
",
expect![[r#"
+ lib:
+ - S (t)
+ - S (v)
main:
- m (t)
- m::S (t)
- m::S (v)
- lib:
- - S (t)
- - S (v)
"#]],
);
}
@@ -697,11 +701,11 @@ mod tests {
}
",
expect![[r#"
+ lib:
+ - pub_macro (m)
main:
- m (t)
- m::pub_macro (m)
- lib:
- - pub_macro (m)
"#]],
);
}
@@ -719,14 +723,14 @@ mod tests {
}
",
expect![[r#"
- main:
- - reexported_module (t)
- - reexported_module::S (t)
- - reexported_module::S (v)
lib:
- module (t)
- module::S (t)
- module::S (v)
+ main:
+ - reexported_module (t)
+ - reexported_module::S (t)
+ - reexported_module::S (v)
"#]],
);
}
@@ -831,10 +835,10 @@ mod tests {
Query::new("fmt".to_string()).search_mode(SearchMode::Fuzzy),
expect![[r#"
dep::fmt (t)
- dep::fmt::Display::format_method (a)
dep::fmt::Display (t)
dep::fmt::Display::FMT_CONST (a)
dep::fmt::Display::format_function (a)
+ dep::fmt::Display::format_method (a)
"#]],
);
}
@@ -860,10 +864,10 @@ mod tests {
"main",
Query::new("fmt".to_string()).search_mode(SearchMode::Fuzzy).assoc_items_only(),
expect![[r#"
- dep::fmt::Display::format_method (a)
- dep::fmt::Display::FMT_CONST (a)
- dep::fmt::Display::format_function (a)
- "#]],
+ dep::fmt::Display::FMT_CONST (a)
+ dep::fmt::Display::format_function (a)
+ dep::fmt::Display::format_method (a)
+ "#]],
);
check_search(
@@ -920,13 +924,13 @@ mod tests {
"main",
Query::new("fmt".to_string()).search_mode(SearchMode::Fuzzy),
expect![[r#"
- dep::fmt (t)
- dep::format (f)
- dep::Fmt (v)
dep::Fmt (m)
dep::Fmt (t)
- dep::fmt::Display::fmt (a)
+ dep::Fmt (v)
+ dep::fmt (t)
dep::fmt::Display (t)
+ dep::fmt::Display::fmt (a)
+ dep::format (f)
"#]],
);
@@ -935,10 +939,10 @@ mod tests {
"main",
Query::new("fmt".to_string()).search_mode(SearchMode::Equals),
expect![[r#"
- dep::fmt (t)
- dep::Fmt (v)
dep::Fmt (m)
dep::Fmt (t)
+ dep::Fmt (v)
+ dep::fmt (t)
dep::fmt::Display::fmt (a)
"#]],
);
@@ -948,12 +952,12 @@ mod tests {
"main",
Query::new("fmt".to_string()).search_mode(SearchMode::Contains),
expect![[r#"
- dep::fmt (t)
- dep::Fmt (v)
dep::Fmt (m)
dep::Fmt (t)
- dep::fmt::Display::fmt (a)
+ dep::Fmt (v)
+ dep::fmt (t)
dep::fmt::Display (t)
+ dep::fmt::Display::fmt (a)
"#]],
);
}
@@ -989,12 +993,12 @@ mod tests {
"main",
Query::new("fmt".to_string()),
expect![[r#"
- dep::fmt (t)
- dep::Fmt (v)
dep::Fmt (m)
dep::Fmt (t)
- dep::fmt::Display::fmt (a)
+ dep::Fmt (v)
+ dep::fmt (t)
dep::fmt::Display (t)
+ dep::fmt::Display::fmt (a)
"#]],
);
@@ -1003,10 +1007,10 @@ mod tests {
"main",
Query::new("fmt".to_string()).name_only(),
expect![[r#"
- dep::fmt (t)
- dep::Fmt (v)
dep::Fmt (m)
dep::Fmt (t)
+ dep::Fmt (v)
+ dep::fmt (t)
dep::fmt::Display::fmt (a)
"#]],
);
@@ -1027,10 +1031,10 @@ mod tests {
"main",
Query::new("FMT".to_string()),
expect![[r#"
- dep::fmt (t)
+ dep::FMT (t)
dep::FMT (v)
+ dep::fmt (t)
dep::fmt (v)
- dep::FMT (t)
"#]],
);
@@ -1068,10 +1072,10 @@ mod tests {
"main",
Query::new("".to_string()).limit(2),
expect![[r#"
- dep::fmt (t)
+ dep::Fmt (m)
dep::Fmt (t)
dep::Fmt (v)
- dep::Fmt (m)
+ dep::fmt (t)
"#]],
);
}
@@ -1091,10 +1095,10 @@ mod tests {
"main",
Query::new("FMT".to_string()),
expect![[r#"
- dep::fmt (t)
+ dep::FMT (t)
dep::FMT (v)
+ dep::fmt (t)
dep::fmt (v)
- dep::FMT (t)
"#]],
);
diff --git a/crates/hir-def/src/nameres.rs b/crates/hir-def/src/nameres.rs
index c67046dfda..3949fbb6e7 100644
--- a/crates/hir-def/src/nameres.rs
+++ b/crates/hir-def/src/nameres.rs
@@ -48,8 +48,8 @@
//! the result
pub mod attr_resolution;
-pub mod diagnostics;
mod collector;
+pub mod diagnostics;
mod mod_resolution;
mod path_resolution;
mod proc_macro;
@@ -57,10 +57,11 @@ mod proc_macro;
#[cfg(test)]
mod tests;
-use std::sync::Arc;
+use std::{cmp::Ord, sync::Arc};
use base_db::{CrateId, Edition, FileId};
use hir_expand::{name::Name, InFile, MacroDefId};
+use itertools::Itertools;
use la_arena::Arena;
use profile::Count;
use rustc_hash::FxHashMap;
@@ -431,7 +432,9 @@ impl DefMap {
map.modules[module].scope.dump(buf);
- for (name, child) in map.modules[module].children.iter() {
+ for (name, child) in
+ map.modules[module].children.iter().sorted_by(|a, b| Ord::cmp(&a.0, &b.0))
+ {
let path = format!("{}::{}", path, name);
buf.push('\n');
go(buf, map, &path, *child);
diff --git a/crates/hir-def/src/nameres/tests.rs b/crates/hir-def/src/nameres/tests.rs
index 80e5476071..70dd2eb3ad 100644
--- a/crates/hir-def/src/nameres/tests.rs
+++ b/crates/hir-def/src/nameres/tests.rs
@@ -648,11 +648,11 @@ mod b {
a: t
b: t
- crate::b
- T: v
-
crate::a
T: t v
+
+ crate::b
+ T: v
"#]],
);
}
@@ -704,13 +704,13 @@ use crate::reex::*;
reex: t
tr: t
- crate::tr
- PrivTr: t
- PubTr: t
-
crate::reex
_: t
_: t
+
+ crate::tr
+ PrivTr: t
+ PubTr: t
"#]],
);
}
@@ -920,14 +920,14 @@ use some_module::unknown_func;
some_module: t
unknown_func: v
- crate::some_module
- unknown_func: v
-
crate::other_module
some_submodule: t
crate::other_module::some_submodule
unknown_func: v
+
+ crate::some_module
+ unknown_func: v
"#]],
)
}
diff --git a/crates/hir-def/src/nameres/tests/globs.rs b/crates/hir-def/src/nameres/tests/globs.rs
index 17426d54d4..b2a6a592cf 100644
--- a/crates/hir-def/src/nameres/tests/globs.rs
+++ b/crates/hir-def/src/nameres/tests/globs.rs
@@ -315,8 +315,13 @@ mod d {
c: t
d: t
- crate::d
- Y: t v
+ crate::a
+ foo: t
+
+ crate::a::foo
+ X: t v
+
+ crate::b
foo: t
crate::c
@@ -325,14 +330,9 @@ mod d {
crate::c::foo
Y: t v
- crate::b
- foo: t
-
- crate::a
+ crate::d
+ Y: t v
foo: t
-
- crate::a::foo
- X: t v
"#]],
);
}
diff --git a/crates/hir-def/src/nameres/tests/macros.rs b/crates/hir-def/src/nameres/tests/macros.rs
index 520a6ae1cb..3ece1379ad 100644
--- a/crates/hir-def/src/nameres/tests/macros.rs
+++ b/crates/hir-def/src/nameres/tests/macros.rs
@@ -1,4 +1,5 @@
use super::*;
+use itertools::Itertools;
#[test]
fn macro_rules_are_globally_visible() {
@@ -439,15 +440,8 @@ macro_rules! baz {
m7: t
ok_double_macro_use_shadow: v
- crate::m7
-
crate::m1
- crate::m5
- m6: t
-
- crate::m5::m6
-
crate::m2
crate::m3
@@ -462,6 +456,13 @@ macro_rules! baz {
ok_shadow_deep: v
crate::m3::m5
+
+ crate::m5
+ m6: t
+
+ crate::m5::m6
+
+ crate::m7
"#]],
);
// FIXME: should not see `NotFoundBefore`
@@ -1171,11 +1172,15 @@ fn proc_attr(a: TokenStream, b: TokenStream) -> TokenStream { a }
);
let root = &def_map[def_map.root()].scope;
- let actual = root.legacy_macros().map(|(name, _)| format!("{name}\n")).collect::<String>();
+ let actual = root
+ .legacy_macros()
+ .sorted_by(|a, b| std::cmp::Ord::cmp(&a.0, &b.0))
+ .map(|(name, _)| format!("{name}\n"))
+ .collect::<String>();
expect![[r#"
- macro20
legacy
+ macro20
proc_attr
"#]]
.assert_eq(&actual);
diff --git a/crates/ide-assists/Cargo.toml b/crates/ide-assists/Cargo.toml
index 51e43d21cb..fca09d384c 100644
--- a/crates/ide-assists/Cargo.toml
+++ b/crates/ide-assists/Cargo.toml
@@ -26,3 +26,6 @@ hir = { path = "../hir", version = "0.0.0" }
test-utils = { path = "../test-utils" }
sourcegen = { path = "../sourcegen" }
expect-test = "1.4.0"
+
+[features]
+in-rust-tree = []
diff --git a/crates/ide-assists/src/tests.rs b/crates/ide-assists/src/tests.rs
index 249a56b4ae..9cd66c6b3b 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 d45e54186b..070b83d3c1 100644
--- a/crates/ide-assists/src/tests/sourcegen.rs
+++ b/crates/ide-assists/src/tests/sourcegen.rs
@@ -59,6 +59,7 @@ r#####"
fs::write(dst, contents).unwrap();
}
}
+
#[derive(Debug)]
struct Section {
doc: String,
@@ -104,9 +105,11 @@ impl Assist {
while lines.peek().is_some() {
let doc = take_until(lines.by_ref(), "```").trim().to_string();
assert!(
- (doc.chars().next().unwrap().is_ascii_uppercase() && doc.ends_with('.')) || assist.sections.len() > 0,
+ (doc.chars().next().unwrap().is_ascii_uppercase() && doc.ends_with('.'))
+ || assist.sections.len() > 0,
"\n\n{}: assist docs should be proper sentences, with capitalization and a full stop at the end.\n\n{}\n\n",
- &assist.id, doc,
+ &assist.id,
+ doc,
);
let before = take_until(lines.by_ref(), "```");
diff --git a/crates/ide-diagnostics/Cargo.toml b/crates/ide-diagnostics/Cargo.toml
index a79adca4cd..e221425edd 100644
--- a/crates/ide-diagnostics/Cargo.toml
+++ b/crates/ide-diagnostics/Cargo.toml
@@ -29,3 +29,6 @@ expect-test = "1.4.0"
test-utils = { path = "../test-utils" }
sourcegen = { path = "../sourcegen" }
+
+[features]
+in-rust-tree = []
diff --git a/crates/ide-diagnostics/src/tests.rs b/crates/ide-diagnostics/src/tests.rs
index 7cd79c7cee..7312bca32f 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/Cargo.toml b/crates/ide/Cargo.toml
index 95a54b75e2..0e9771cd2e 100644
--- a/crates/ide/Cargo.toml
+++ b/crates/ide/Cargo.toml
@@ -42,3 +42,6 @@ toolchain = { path = "../toolchain", version = "0.0.0" }
[dev-dependencies]
test-utils = { path = "../test-utils" }
expect-test = "1.4.0"
+
+[features]
+in-rust-tree = ["ide-assists/in-rust-tree", "ide-diagnostics/in-rust-tree"]
diff --git a/crates/proc-macro-test/build.rs b/crates/proc-macro-test/build.rs
index cd99eea5ae..a80c962617 100644
--- a/crates/proc-macro-test/build.rs
+++ b/crates/proc-macro-test/build.rs
@@ -62,17 +62,18 @@ fn main() {
Command::new(toolchain::cargo())
};
- let output = cmd
- .current_dir(&staging_dir)
+ cmd.current_dir(&staging_dir)
.args(&["build", "-p", "proc-macro-test-impl", "--message-format", "json"])
// Explicit override the target directory to avoid using the same one which the parent
// cargo is using, or we'll deadlock.
// This can happen when `CARGO_TARGET_DIR` is set or global config forces all cargo
// instance to use the same target directory.
.arg("--target-dir")
- .arg(&target_dir)
- .output()
- .unwrap();
+ .arg(&target_dir);
+
+ println!("Running {:?}", cmd);
+
+ let output = cmd.output().unwrap();
if !output.status.success() {
println!("proc-macro-test-impl failed to build");
println!("============ stdout ============");
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 41205f2584..07771d1b39 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -84,4 +84,9 @@ mbe = { path = "../mbe" }
[features]
jemalloc = ["jemallocator", "profile/jemalloc"]
force-always-assert = ["always-assert/force"]
-in-rust-tree = ["proc-macro-srv/sysroot-abi"]
+in-rust-tree = [
+ "proc-macro-srv/sysroot-abi",
+ "sourcegen/in-rust-tree",
+ "ide/in-rust-tree",
+ "syntax/in-rust-tree"
+]
diff --git a/crates/rust-analyzer/tests/slow-tests/main.rs b/crates/rust-analyzer/tests/slow-tests/main.rs
index eef76343dc..4cc46af1b1 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/tidy.rs b/crates/rust-analyzer/tests/slow-tests/tidy.rs
index dc3c5539c2..18f95925d9 100644
--- a/crates/rust-analyzer/tests/slow-tests/tidy.rs
+++ b/crates/rust-analyzer/tests/slow-tests/tidy.rs
@@ -3,8 +3,12 @@ use std::{
path::{Path, PathBuf},
};
-use xshell::{cmd, Shell};
+use xshell::Shell;
+#[cfg(not(feature = "in-rust-tree"))]
+use xshell::cmd;
+
+#[cfg(not(feature = "in-rust-tree"))]
#[test]
fn check_code_formatting() {
let sh = &Shell::new().unwrap();
@@ -168,6 +172,7 @@ See https://github.com/rust-lang/rust-clippy/issues/5537 for discussion.
}
}
+#[cfg(not(feature = "in-rust-tree"))]
#[test]
fn check_licenses() {
let sh = &Shell::new().unwrap();
diff --git a/crates/sourcegen/Cargo.toml b/crates/sourcegen/Cargo.toml
index e75867e2d8..a84110d940 100644
--- a/crates/sourcegen/Cargo.toml
+++ b/crates/sourcegen/Cargo.toml
@@ -11,3 +11,6 @@ doctest = false
[dependencies]
xshell = "0.2.2"
+
+[features]
+in-rust-tree = []
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index a56c9dec40..0e2dec386f 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -34,3 +34,6 @@ ungrammar = "1.16.1"
test-utils = { path = "../test-utils" }
sourcegen = { path = "../sourcegen" }
+
+[features]
+in-rust-tree = []
diff --git a/crates/syntax/src/tests.rs b/crates/syntax/src/tests.rs
index 0611143e2a..58fba8cfa8 100644
--- a/crates/syntax/src/tests.rs
+++ b/crates/syntax/src/tests.rs
@@ -1,5 +1,7 @@
-mod sourcegen_ast;
+#[cfg(not(feature = "in-rust-tree"))]
mod ast_src;
+#[cfg(not(feature = "in-rust-tree"))]
+mod sourcegen_ast;
use std::{
fs,
diff --git a/crates/syntax/test_data/parser/validation/0045_ambiguous_trait_object.rs b/crates/syntax/test_data/parser/validation/0045_ambiguous_trait_object.rs
index 3a73d81bb5..0a5958f25f 100644
--- a/crates/syntax/test_data/parser/validation/0045_ambiguous_trait_object.rs
+++ b/crates/syntax/test_data/parser/validation/0045_ambiguous_trait_object.rs
@@ -1,6 +1,6 @@
-type Foo<'a> = &'a dyn Send + Sync;
-type Foo = *const dyn Send + Sync;
-type Foo = fn() -> dyn Send + 'static;
-fn main() {
- let b = (&a) as &dyn Add<Other, Output = Addable> + Other;
-}
+type Foo<'a> = &'a dyn Send + Sync;
+type Foo = *const dyn Send + Sync;
+type Foo = fn() -> dyn Send + 'static;
+fn main() {
+ let b = (&a) as &dyn Add<Other, Output = Addable> + Other;
+}
diff --git a/crates/syntax/test_data/parser/validation/0046_mutable_const_item.rs b/crates/syntax/test_data/parser/validation/0046_mutable_const_item.rs
index b34336f3f1..ccab6bccfa 100644
--- a/crates/syntax/test_data/parser/validation/0046_mutable_const_item.rs
+++ b/crates/syntax/test_data/parser/validation/0046_mutable_const_item.rs
@@ -1 +1 @@
-const mut FOO: () = ();
+const mut FOO: () = ();
diff --git a/crates/syntax/test_data/parser/validation/invalid_let_expr.rast b/crates/syntax/test_data/parser/validation/invalid_let_expr.rast
index 5b37b59783..9e1e488640 100644
--- a/crates/syntax/test_data/parser/validation/invalid_let_expr.rast
+++ b/crates/syntax/test_data/parser/validation/invalid_let_expr.rast
@@ -1,216 +1,216 @@
-error 29..41: `let` expressions are not supported here
-error 67..79: `let` expressions are not supported here
-error 126..138: `let` expressions are not supported here
+error 29..41: `let` expressions are not supported here
+error 67..79: `let` expressions are not supported here
+error 126..138: `let` expressions are not supported here
diff --git a/crates/test-utils/src/lib.rs b/crates/test-utils/src/lib.rs
index dedfbd7afe..8a9cfb6c22 100644
--- a/crates/test-utils/src/lib.rs
+++ b/crates/test-utils/src/lib.rs
@@ -8,9 +8,9 @@
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
+mod assert_linear;
pub mod bench_fixture;
mod fixture;
-mod assert_linear;
use std::{
collections::BTreeMap,
@@ -391,7 +391,8 @@ fn main() {
/// also creates a file at `./target/.slow_tests_cookie` which serves as a flag
/// that slow tests did run.
pub fn skip_slow_tests() -> bool {
- let should_skip = std::env::var("CI").is_err() && std::env::var("RUN_SLOW_TESTS").is_err();
+ let should_skip = (std::env::var("CI").is_err() && std::env::var("RUN_SLOW_TESTS").is_err())
+ || std::env::var("SKIP_SLOW_TESTS").is_ok();
if should_skip {
eprintln!("ignoring slow test");
} else {
@@ -475,7 +476,7 @@ pub fn ensure_file_contents(file: &Path, contents: &str) {
pub fn try_ensure_file_contents(file: &Path, contents: &str) -> Result<(), ()> {
match std::fs::read_to_string(file) {
Ok(old_contents) if normalize_newlines(&old_contents) == normalize_newlines(contents) => {
- return Ok(())
+ return Ok(());
}
_ => (),
}