Align config's API with usage

The config now is mostly immutable, optimize for that.
This commit is contained in:
Aleksey Kladov 2021-01-06 20:43:46 +03:00
parent 7ae4b8bdb6
commit f8a0561178
22 changed files with 164 additions and 162 deletions

View file

@ -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<SnippetCap> {
if allow_snippets {
Some(SnippetCap { _private: () })
} else {
None
}
}
}