diff options
-rw-r--r-- | Cargo.lock | 13 | ||||
-rw-r--r-- | crates/ra_assists/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 6 | ||||
-rw-r--r-- | crates/ra_prof/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ra_prof/src/lib.rs | 27 |
5 files changed, 28 insertions, 22 deletions
diff --git a/Cargo.lock b/Cargo.lock index 2c03d0b75..92a377497 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -874,6 +874,14 @@ version = "0.1.0" | |||
874 | source = "registry+https://github.com/rust-lang/crates.io-index" | 874 | source = "registry+https://github.com/rust-lang/crates.io-index" |
875 | 875 | ||
876 | [[package]] | 876 | [[package]] |
877 | name = "once_cell" | ||
878 | version = "0.2.0" | ||
879 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
880 | dependencies = [ | ||
881 | "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
882 | ] | ||
883 | |||
884 | [[package]] | ||
877 | name = "opaque-debug" | 885 | name = "opaque-debug" |
878 | version = "0.2.2" | 886 | version = "0.2.2" |
879 | source = "registry+https://github.com/rust-lang/crates.io-index" | 887 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1039,7 +1047,7 @@ dependencies = [ | |||
1039 | "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", | 1047 | "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", |
1040 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1048 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1041 | "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | 1049 | "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", |
1042 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1050 | "once_cell 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1043 | "ra_db 0.1.0", | 1051 | "ra_db 0.1.0", |
1044 | "ra_fmt 0.1.0", | 1052 | "ra_fmt 0.1.0", |
1045 | "ra_hir 0.1.0", | 1053 | "ra_hir 0.1.0", |
@@ -1209,7 +1217,7 @@ dependencies = [ | |||
1209 | name = "ra_prof" | 1217 | name = "ra_prof" |
1210 | version = "0.1.0" | 1218 | version = "0.1.0" |
1211 | dependencies = [ | 1219 | dependencies = [ |
1212 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1220 | "once_cell 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1213 | ] | 1221 | ] |
1214 | 1222 | ||
1215 | [[package]] | 1223 | [[package]] |
@@ -2121,6 +2129,7 @@ dependencies = [ | |||
2121 | "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" | 2129 | "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" |
2122 | "checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" | 2130 | "checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" |
2123 | "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" | 2131 | "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" |
2132 | "checksum once_cell 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e7a15c6c8c034b56d2f01b23b98cdbbb622f8de99efad0d93d8ea0e608b36a7e" | ||
2124 | "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" | 2133 | "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" |
2125 | "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" | 2134 | "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" |
2126 | "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" | 2135 | "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" |
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml index 29d9ceb59..5ddac1e48 100644 --- a/crates/ra_assists/Cargo.toml +++ b/crates/ra_assists/Cargo.toml | |||
@@ -5,7 +5,7 @@ version = "0.1.0" | |||
5 | authors = ["rust-analyzer developers"] | 5 | authors = ["rust-analyzer developers"] |
6 | 6 | ||
7 | [dependencies] | 7 | [dependencies] |
8 | lazy_static = "1.3.0" | 8 | once_cell = "0.2.0" |
9 | join_to_string = "0.1.3" | 9 | join_to_string = "0.1.3" |
10 | itertools = "0.8.0" | 10 | itertools = "0.8.0" |
11 | arrayvec = "0.4.10" | 11 | arrayvec = "0.4.10" |
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index 726e5c0a3..aa7aeaabb 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs | |||
@@ -289,12 +289,10 @@ fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> { | |||
289 | } | 289 | } |
290 | 290 | ||
291 | mod tokens { | 291 | mod tokens { |
292 | use lazy_static::lazy_static; | 292 | use once_cell::sync::Lazy; |
293 | use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*}; | 293 | use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*}; |
294 | 294 | ||
295 | lazy_static! { | 295 | static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;")); |
296 | static ref SOURCE_FILE: TreeArc<SourceFile> = SourceFile::parse(",\n; ;"); | ||
297 | } | ||
298 | 296 | ||
299 | pub(crate) fn comma() -> SyntaxToken<'static> { | 297 | pub(crate) fn comma() -> SyntaxToken<'static> { |
300 | SOURCE_FILE | 298 | SOURCE_FILE |
diff --git a/crates/ra_prof/Cargo.toml b/crates/ra_prof/Cargo.toml index 19ce21783..5f23e865c 100644 --- a/crates/ra_prof/Cargo.toml +++ b/crates/ra_prof/Cargo.toml | |||
@@ -6,4 +6,4 @@ authors = ["rust-analyzer developers"] | |||
6 | publish = false | 6 | publish = false |
7 | 7 | ||
8 | [dependencies] | 8 | [dependencies] |
9 | lazy_static = "1.3.0" \ No newline at end of file | 9 | once_cell = "0.2.0" |
diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index 9ecb8e744..e56446c9f 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs | |||
@@ -1,13 +1,14 @@ | |||
1 | use std::cell::RefCell; | 1 | use std::{ |
2 | use std::time::{Duration, Instant}; | 2 | cell::RefCell, |
3 | use std::mem; | 3 | time::{Duration, Instant}, |
4 | use std::io::{stderr, Write}; | 4 | mem, |
5 | use std::iter::repeat; | 5 | io::{stderr, Write}, |
6 | use std::collections::{HashSet}; | 6 | iter::repeat, |
7 | use std::default::Default; | 7 | collections::HashSet, |
8 | use std::iter::FromIterator; | 8 | sync::{RwLock, atomic::{AtomicBool, Ordering}}, |
9 | use std::sync::{RwLock, atomic::{AtomicBool, Ordering}}; | 9 | }; |
10 | use lazy_static::lazy_static; | 10 | |
11 | use once_cell::sync::Lazy; | ||
11 | 12 | ||
12 | /// Set profiling filter. It specifies descriptions allowed to profile. | 13 | /// Set profiling filter. It specifies descriptions allowed to profile. |
13 | /// This is helpful when call stack has too many nested profiling scopes. | 14 | /// This is helpful when call stack has too many nested profiling scopes. |
@@ -21,7 +22,7 @@ use lazy_static::lazy_static; | |||
21 | /// ``` | 22 | /// ``` |
22 | pub fn set_filter(f: Filter) { | 23 | pub fn set_filter(f: Filter) { |
23 | PROFILING_ENABLED.store(f.depth > 0, Ordering::SeqCst); | 24 | PROFILING_ENABLED.store(f.depth > 0, Ordering::SeqCst); |
24 | let set = HashSet::from_iter(f.allowed.iter().cloned()); | 25 | let set: HashSet<_> = f.allowed.iter().cloned().collect(); |
25 | let mut old = FILTER.write().unwrap(); | 26 | let mut old = FILTER.write().unwrap(); |
26 | let filter_data = FilterData { | 27 | let filter_data = FilterData { |
27 | depth: f.depth, | 28 | depth: f.depth, |
@@ -161,9 +162,7 @@ struct FilterData { | |||
161 | 162 | ||
162 | static PROFILING_ENABLED: AtomicBool = AtomicBool::new(false); | 163 | static PROFILING_ENABLED: AtomicBool = AtomicBool::new(false); |
163 | 164 | ||
164 | lazy_static! { | 165 | static FILTER: Lazy<RwLock<FilterData>> = Lazy::new(Default::default); |
165 | static ref FILTER: RwLock<FilterData> = RwLock::new(Default::default()); | ||
166 | } | ||
167 | 166 | ||
168 | thread_local!(static PROFILE_STACK: RefCell<ProfileStack> = RefCell::new(ProfileStack::new())); | 167 | thread_local!(static PROFILE_STACK: RefCell<ProfileStack> = RefCell::new(ProfileStack::new())); |
169 | 168 | ||