diff options
author | Aleksey Kladov <[email protected]> | 2021-01-06 17:43:46 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-01-06 18:22:24 +0000 |
commit | f8a056117898c56d34d1758455bc54df50e2e426 (patch) | |
tree | 429e2c7284476213432b66b02ab9b76f6525eb92 /crates/ide_db | |
parent | 7ae4b8bdb62735ee767dff25ce1485ae8bffe199 (diff) |
Align config's API with usage
The config now is mostly immutable, optimize for that.
Diffstat (limited to 'crates/ide_db')
-rw-r--r-- | crates/ide_db/src/helpers.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/crates/ide_db/src/helpers.rs b/crates/ide_db/src/helpers.rs index d988588ff..e3e5670f1 100644 --- a/crates/ide_db/src/helpers.rs +++ b/crates/ide_db/src/helpers.rs | |||
@@ -1,9 +1,10 @@ | |||
1 | //! A module with ide helpers for high-level ide features. | 1 | //! A module with ide helpers for high-level ide features. |
2 | use crate::RootDatabase; | 2 | pub mod insert_use; |
3 | |||
3 | use hir::{Crate, Enum, Module, ScopeDef, Semantics, Trait}; | 4 | use hir::{Crate, Enum, Module, ScopeDef, Semantics, Trait}; |
4 | use syntax::ast::{self, make}; | 5 | use syntax::ast::{self, make}; |
5 | 6 | ||
6 | pub mod insert_use; | 7 | use crate::RootDatabase; |
7 | 8 | ||
8 | /// Converts the mod path struct into its ast representation. | 9 | /// Converts the mod path struct into its ast representation. |
9 | pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path { | 10 | pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path { |
@@ -201,3 +202,18 @@ pub use prelude::*; | |||
201 | Some(def) | 202 | Some(def) |
202 | } | 203 | } |
203 | } | 204 | } |
205 | |||
206 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] | ||
207 | pub struct SnippetCap { | ||
208 | _private: (), | ||
209 | } | ||
210 | |||
211 | impl SnippetCap { | ||
212 | pub const fn new(allow_snippets: bool) -> Option<SnippetCap> { | ||
213 | if allow_snippets { | ||
214 | Some(SnippetCap { _private: () }) | ||
215 | } else { | ||
216 | None | ||
217 | } | ||
218 | } | ||
219 | } | ||