internal: refactor prefer_no_std/prefer_prelude bools into a struct

This commit is contained in:
David Barsky 2024-05-17 15:00:21 -04:00 committed by Lukas Wirth
parent 6a16749eb0
commit b75301cec8
37 changed files with 304 additions and 351 deletions

View file

@ -1,6 +1,6 @@
//! Completion of names from the current scope in expression position.
use hir::ScopeDef;
use hir::{ImportPathConfig, ScopeDef};
use syntax::ast;
use crate::{
@ -174,8 +174,10 @@ pub(crate) fn complete_expr_path(
.find_path(
ctx.db,
hir::ModuleDef::from(strukt),
ctx.config.prefer_no_std,
ctx.config.prefer_prelude,
ImportPathConfig {
prefer_no_std: ctx.config.prefer_no_std,
prefer_prelude: ctx.config.prefer_prelude,
},
)
.filter(|it| it.len() > 1);
@ -197,8 +199,10 @@ pub(crate) fn complete_expr_path(
.find_path(
ctx.db,
hir::ModuleDef::from(un),
ctx.config.prefer_no_std,
ctx.config.prefer_prelude,
ImportPathConfig {
prefer_no_std: ctx.config.prefer_no_std,
prefer_prelude: ctx.config.prefer_prelude,
},
)
.filter(|it| it.len() > 1);