diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-06 18:27:02 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-06 18:27:02 +0000 |
commit | 959406aeb5379024bd7b2143688cfa07e073fc99 (patch) | |
tree | 429e2c7284476213432b66b02ab9b76f6525eb92 /crates/ide_db/src | |
parent | 7ae4b8bdb62735ee767dff25ce1485ae8bffe199 (diff) | |
parent | f8a056117898c56d34d1758455bc54df50e2e426 (diff) |
Merge #7186
7186: Align config's API with usage r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide_db/src')
-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 | } | ||