From f8a056117898c56d34d1758455bc54df50e2e426 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 6 Jan 2021 20:43:46 +0300 Subject: Align config's API with usage The config now is mostly immutable, optimize for that. --- crates/ide_db/src/helpers.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'crates/ide_db/src') 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 @@ //! A module with ide helpers for high-level ide features. -use crate::RootDatabase; +pub mod insert_use; + use hir::{Crate, Enum, Module, ScopeDef, Semantics, Trait}; use syntax::ast::{self, make}; -pub mod insert_use; +use crate::RootDatabase; /// Converts the mod path struct into its ast representation. pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path { @@ -201,3 +202,18 @@ pub use prelude::*; Some(def) } } + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct SnippetCap { + _private: (), +} + +impl SnippetCap { + pub const fn new(allow_snippets: bool) -> Option { + if allow_snippets { + Some(SnippetCap { _private: () }) + } else { + None + } + } +} -- cgit v1.2.3