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

@ -108,6 +108,15 @@ use crate::{
type FxIndexMap<K, V> =
indexmap::IndexMap<K, V, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
/// A wrapper around two booleans, [`ImportPathConfig::prefer_no_std`] and [`ImportPathConfig::prefer_prelude`].
#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)]
pub struct ImportPathConfig {
/// If true, prefer to unconditionally use imports of the `core` and `alloc` crate
/// over the std.
pub prefer_no_std: bool,
/// If true, prefer import paths containing a prelude module.
pub prefer_prelude: bool,
}
#[derive(Debug)]
pub struct ItemLoc<N: ItemTreeNode> {