Cleanup cfg and env handling in project-model

This commit is contained in:
Lukas Wirth 2024-04-19 10:41:08 +02:00
parent 2e54c0af40
commit ee10f9f5cd
9 changed files with 193 additions and 114 deletions

View file

@ -331,10 +331,11 @@ impl CrateGraph {
version: Option<String>,
cfg_options: Arc<CfgOptions>,
potential_cfg_options: Option<Arc<CfgOptions>>,
env: Env,
mut env: Env,
is_proc_macro: bool,
origin: CrateOrigin,
) -> CrateId {
env.entries.shrink_to_fit();
let data = CrateData {
root_file_id,
edition,
@ -651,8 +652,8 @@ impl FromIterator<(String, String)> for Env {
}
impl Env {
pub fn set(&mut self, env: &str, value: String) {
self.entries.insert(env.to_owned(), value);
pub fn set(&mut self, env: &str, value: impl Into<String>) {
self.entries.insert(env.to_owned(), value.into());
}
pub fn get(&self, env: &str) -> Option<String> {