diff options
| author | btwotwo <10519967+btwotwo@users.noreply.github.com> | 2022-10-11 19:23:41 +0200 |
|---|---|---|
| committer | btwotwo <10519967+btwotwo@users.noreply.github.com> | 2022-10-11 19:23:41 +0200 |
| commit | 3c39668ca464919ed4180049945b3e2b9bf6191a (patch) | |
| tree | 1220924a6a21c4dc354afaf68356cceb879d4b54 | |
| parent | 3732d159b2e7dec436f8bb91c53832e56b1f2720 (diff) | |
| download | rust-3c39668ca464919ed4180049945b3e2b9bf6191a.tar.gz rust-3c39668ca464919ed4180049945b3e2b9bf6191a.zip | |
Remove extra parameter, access Db through semantics
| -rw-r--r-- | crates/ide-completion/src/completions/env_vars.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ide-completion/src/completions/env_vars.rs b/crates/ide-completion/src/completions/env_vars.rs index 5483fdf31a2..a3a97130394 100644 --- a/crates/ide-completion/src/completions/env_vars.rs +++ b/crates/ide-completion/src/completions/env_vars.rs @@ -18,7 +18,8 @@ const CARGO_DEFINED_VARS: &[(&str, &str)] = &[ ("CARGO_PKG_NAME","The name of your package"), ("CARGO_PKG_DESCRIPTION","The description from the manifest of your package"), ("CARGO_PKG_HOMEPAGE","The home page from the manifest of your package"), -("CARGO_PKG_REPOSITORY","The repository from the manifest of your package"), + ("CARGO_PKG_REPOSITORY", +"The repository from the manifest of your package"), ("CARGO_PKG_LICENSE","The license from the manifest of your package"), ("CARGO_PKG_LICENSE_FILE","The license file from the manifest of your package"), ("CARGO_PKG_RUST_VERSION","The Rust version from the manifest of your package. Note that this is the minimum Rust version supported by the package, not the current Rust version"), @@ -33,7 +34,7 @@ pub(crate) fn complete_cargo_env_vars( ctx: &CompletionContext<'_>, expanded: &ast::String, ) -> Option<()> { - guard_env_macro(expanded, &ctx.sema, &ctx.db)?; + guard_env_macro(expanded, &ctx.sema)?; let range = expanded.text_range_between_quotes()?; CARGO_DEFINED_VARS.iter().for_each(|(var, detail)| { @@ -48,11 +49,11 @@ pub(crate) fn complete_cargo_env_vars( fn guard_env_macro( string: &ast::String, semantics: &Semantics<'_, RootDatabase>, - db: &RootDatabase, ) -> Option<()> { let call = get_outer_macro(string)?; let name = call.path()?.segment()?.name_ref()?; let makro = semantics.resolve_macro_call(&call)?; + let db = semantics.db; match name.text().as_str() { "env" | "option_env" if makro.kind(db) == hir::MacroKind::BuiltIn => Some(()), |
