aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src/helpers.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-01-06 17:43:46 +0000
committerAleksey Kladov <[email protected]>2021-01-06 18:22:24 +0000
commitf8a056117898c56d34d1758455bc54df50e2e426 (patch)
tree429e2c7284476213432b66b02ab9b76f6525eb92 /crates/ide_db/src/helpers.rs
parent7ae4b8bdb62735ee767dff25ce1485ae8bffe199 (diff)
Align config's API with usage
The config now is mostly immutable, optimize for that.
Diffstat (limited to 'crates/ide_db/src/helpers.rs')
-rw-r--r--crates/ide_db/src/helpers.rs20
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.
2use crate::RootDatabase; 2pub mod insert_use;
3
3use hir::{Crate, Enum, Module, ScopeDef, Semantics, Trait}; 4use hir::{Crate, Enum, Module, ScopeDef, Semantics, Trait};
4use syntax::ast::{self, make}; 5use syntax::ast::{self, make};
5 6
6pub mod insert_use; 7use crate::RootDatabase;
7 8
8/// Converts the mod path struct into its ast representation. 9/// Converts the mod path struct into its ast representation.
9pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path { 10pub 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)]
207pub struct SnippetCap {
208 _private: (),
209}
210
211impl 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}