diff options
author | Aleksey Kladov <[email protected]> | 2019-12-22 14:31:30 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-22 14:31:30 +0000 |
commit | e8da7d4061960844502e3064c33eef4a0dc3828e (patch) | |
tree | b2200ed8cd948ba10959dfa54bf31bba7badcb6e /crates/ra_hir_def/src/nameres/collector.rs | |
parent | 558956c84be5e8752986bae001c7fd3f06cbe86d (diff) |
Remove unused parameters
Diffstat (limited to 'crates/ra_hir_def/src/nameres/collector.rs')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 3706c1223..d27c3e197 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -215,11 +215,7 @@ where | |||
215 | // In Rust, `#[macro_export]` macros are unconditionally visible at the | 215 | // In Rust, `#[macro_export]` macros are unconditionally visible at the |
216 | // crate root, even if the parent modules is **not** visible. | 216 | // crate root, even if the parent modules is **not** visible. |
217 | if export { | 217 | if export { |
218 | self.update( | 218 | self.update(self.def_map.root, &[(name, Resolution { def: PerNs::macros(macro_) })]); |
219 | self.def_map.root, | ||
220 | None, | ||
221 | &[(name, Resolution { def: PerNs::macros(macro_) })], | ||
222 | ); | ||
223 | } | 219 | } |
224 | } | 220 | } |
225 | 221 | ||
@@ -373,7 +369,7 @@ where | |||
373 | // Module scoped macros is included | 369 | // Module scoped macros is included |
374 | let items = scope.collect_resolutions(); | 370 | let items = scope.collect_resolutions(); |
375 | 371 | ||
376 | self.update(module_id, Some(import_id), &items); | 372 | self.update(module_id, &items); |
377 | } else { | 373 | } else { |
378 | // glob import from same crate => we do an initial | 374 | // glob import from same crate => we do an initial |
379 | // import, and then need to propagate any further | 375 | // import, and then need to propagate any further |
@@ -383,7 +379,7 @@ where | |||
383 | // Module scoped macros is included | 379 | // Module scoped macros is included |
384 | let items = scope.collect_resolutions(); | 380 | let items = scope.collect_resolutions(); |
385 | 381 | ||
386 | self.update(module_id, Some(import_id), &items); | 382 | self.update(module_id, &items); |
387 | // record the glob import in case we add further items | 383 | // record the glob import in case we add further items |
388 | let glob = self.glob_imports.entry(m.local_id).or_default(); | 384 | let glob = self.glob_imports.entry(m.local_id).or_default(); |
389 | if !glob.iter().any(|it| *it == (module_id, import_id)) { | 385 | if !glob.iter().any(|it| *it == (module_id, import_id)) { |
@@ -406,7 +402,7 @@ where | |||
406 | (name, res) | 402 | (name, res) |
407 | }) | 403 | }) |
408 | .collect::<Vec<_>>(); | 404 | .collect::<Vec<_>>(); |
409 | self.update(module_id, Some(import_id), &resolutions); | 405 | self.update(module_id, &resolutions); |
410 | } | 406 | } |
411 | Some(d) => { | 407 | Some(d) => { |
412 | log::debug!("glob import {:?} from non-module/enum {:?}", import, d); | 408 | log::debug!("glob import {:?} from non-module/enum {:?}", import, d); |
@@ -429,26 +425,20 @@ where | |||
429 | } | 425 | } |
430 | 426 | ||
431 | let resolution = Resolution { def }; | 427 | let resolution = Resolution { def }; |
432 | self.update(module_id, Some(import_id), &[(name, resolution)]); | 428 | self.update(module_id, &[(name, resolution)]); |
433 | } | 429 | } |
434 | None => tested_by!(bogus_paths), | 430 | None => tested_by!(bogus_paths), |
435 | } | 431 | } |
436 | } | 432 | } |
437 | } | 433 | } |
438 | 434 | ||
439 | fn update( | 435 | fn update(&mut self, module_id: LocalModuleId, resolutions: &[(Name, Resolution)]) { |
440 | &mut self, | 436 | self.update_recursive(module_id, resolutions, 0) |
441 | module_id: LocalModuleId, | ||
442 | import: Option<raw::Import>, | ||
443 | resolutions: &[(Name, Resolution)], | ||
444 | ) { | ||
445 | self.update_recursive(module_id, import, resolutions, 0) | ||
446 | } | 437 | } |
447 | 438 | ||
448 | fn update_recursive( | 439 | fn update_recursive( |
449 | &mut self, | 440 | &mut self, |
450 | module_id: LocalModuleId, | 441 | module_id: LocalModuleId, |
451 | import: Option<raw::Import>, | ||
452 | resolutions: &[(Name, Resolution)], | 442 | resolutions: &[(Name, Resolution)], |
453 | depth: usize, | 443 | depth: usize, |
454 | ) { | 444 | ) { |
@@ -459,7 +449,7 @@ where | |||
459 | let scope = &mut self.def_map.modules[module_id].scope; | 449 | let scope = &mut self.def_map.modules[module_id].scope; |
460 | let mut changed = false; | 450 | let mut changed = false; |
461 | for (name, res) in resolutions { | 451 | for (name, res) in resolutions { |
462 | changed |= scope.push_res(name.clone(), res, import.is_some()); | 452 | changed |= scope.push_res(name.clone(), res); |
463 | } | 453 | } |
464 | 454 | ||
465 | if !changed { | 455 | if !changed { |
@@ -472,9 +462,9 @@ where | |||
472 | .flat_map(|v| v.iter()) | 462 | .flat_map(|v| v.iter()) |
473 | .cloned() | 463 | .cloned() |
474 | .collect::<Vec<_>>(); | 464 | .collect::<Vec<_>>(); |
475 | for (glob_importing_module, glob_import) in glob_imports { | 465 | for (glob_importing_module, _glob_import) in glob_imports { |
476 | // We pass the glob import so that the tracked import in those modules is that glob import | 466 | // We pass the glob import so that the tracked import in those modules is that glob import |
477 | self.update_recursive(glob_importing_module, Some(glob_import), resolutions, depth + 1); | 467 | self.update_recursive(glob_importing_module, resolutions, depth + 1); |
478 | } | 468 | } |
479 | } | 469 | } |
480 | 470 | ||
@@ -716,7 +706,7 @@ where | |||
716 | let def: ModuleDefId = module.into(); | 706 | let def: ModuleDefId = module.into(); |
717 | self.def_collector.def_map.modules[self.module_id].scope.define_def(def); | 707 | self.def_collector.def_map.modules[self.module_id].scope.define_def(def); |
718 | let resolution = Resolution { def: def.into() }; | 708 | let resolution = Resolution { def: def.into() }; |
719 | self.def_collector.update(self.module_id, None, &[(name, resolution)]); | 709 | self.def_collector.update(self.module_id, &[(name, resolution)]); |
720 | res | 710 | res |
721 | } | 711 | } |
722 | 712 | ||
@@ -776,7 +766,7 @@ where | |||
776 | }; | 766 | }; |
777 | self.def_collector.def_map.modules[self.module_id].scope.define_def(def); | 767 | self.def_collector.def_map.modules[self.module_id].scope.define_def(def); |
778 | let resolution = Resolution { def: def.into() }; | 768 | let resolution = Resolution { def: def.into() }; |
779 | self.def_collector.update(self.module_id, None, &[(name, resolution)]) | 769 | self.def_collector.update(self.module_id, &[(name, resolution)]) |
780 | } | 770 | } |
781 | 771 | ||
782 | fn collect_derives(&mut self, attrs: &Attrs, def: &raw::DefData) { | 772 | fn collect_derives(&mut self, attrs: &Attrs, def: &raw::DefData) { |