mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Cleanup cfg and env handling in project-model
This commit is contained in:
parent
2e54c0af40
commit
ee10f9f5cd
9 changed files with 193 additions and 114 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue