Skip to content

Commit e8da7d4

Browse files
committed
Remove unused parameters
1 parent 558956c commit e8da7d4

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

crates/ra_hir_def/src/item_scope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl ItemScope {
111111
self.legacy_macros.insert(name, mac);
112112
}
113113

114-
pub(crate) fn push_res(&mut self, name: Name, res: &Resolution, _import: bool) -> bool {
114+
pub(crate) fn push_res(&mut self, name: Name, res: &Resolution) -> bool {
115115
let mut changed = false;
116116
let existing = self.visible.entry(name.clone()).or_default();
117117

crates/ra_hir_def/src/nameres/collector.rs

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,7 @@ where
215215
// In Rust, `#[macro_export]` macros are unconditionally visible at the
216216
// crate root, even if the parent modules is **not** visible.
217217
if export {
218-
self.update(
219-
self.def_map.root,
220-
None,
221-
&[(name, Resolution { def: PerNs::macros(macro_) })],
222-
);
218+
self.update(self.def_map.root, &[(name, Resolution { def: PerNs::macros(macro_) })]);
223219
}
224220
}
225221

@@ -373,7 +369,7 @@ where
373369
// Module scoped macros is included
374370
let items = scope.collect_resolutions();
375371

376-
self.update(module_id, Some(import_id), &items);
372+
self.update(module_id, &items);
377373
} else {
378374
// glob import from same crate => we do an initial
379375
// import, and then need to propagate any further
@@ -383,7 +379,7 @@ where
383379
// Module scoped macros is included
384380
let items = scope.collect_resolutions();
385381

386-
self.update(module_id, Some(import_id), &items);
382+
self.update(module_id, &items);
387383
// record the glob import in case we add further items
388384
let glob = self.glob_imports.entry(m.local_id).or_default();
389385
if !glob.iter().any(|it| *it == (module_id, import_id)) {
@@ -406,7 +402,7 @@ where
406402
(name, res)
407403
})
408404
.collect::<Vec<_>>();
409-
self.update(module_id, Some(import_id), &resolutions);
405+
self.update(module_id, &resolutions);
410406
}
411407
Some(d) => {
412408
log::debug!("glob import {:?} from non-module/enum {:?}", import, d);
@@ -429,26 +425,20 @@ where
429425
}
430426

431427
let resolution = Resolution { def };
432-
self.update(module_id, Some(import_id), &[(name, resolution)]);
428+
self.update(module_id, &[(name, resolution)]);
433429
}
434430
None => tested_by!(bogus_paths),
435431
}
436432
}
437433
}
438434

439-
fn update(
440-
&mut self,
441-
module_id: LocalModuleId,
442-
import: Option<raw::Import>,
443-
resolutions: &[(Name, Resolution)],
444-
) {
445-
self.update_recursive(module_id, import, resolutions, 0)
435+
fn update(&mut self, module_id: LocalModuleId, resolutions: &[(Name, Resolution)]) {
436+
self.update_recursive(module_id, resolutions, 0)
446437
}
447438

448439
fn update_recursive(
449440
&mut self,
450441
module_id: LocalModuleId,
451-
import: Option<raw::Import>,
452442
resolutions: &[(Name, Resolution)],
453443
depth: usize,
454444
) {
@@ -459,7 +449,7 @@ where
459449
let scope = &mut self.def_map.modules[module_id].scope;
460450
let mut changed = false;
461451
for (name, res) in resolutions {
462-
changed |= scope.push_res(name.clone(), res, import.is_some());
452+
changed |= scope.push_res(name.clone(), res);
463453
}
464454

465455
if !changed {
@@ -472,9 +462,9 @@ where
472462
.flat_map(|v| v.iter())
473463
.cloned()
474464
.collect::<Vec<_>>();
475-
for (glob_importing_module, glob_import) in glob_imports {
465+
for (glob_importing_module, _glob_import) in glob_imports {
476466
// 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);
478468
}
479469
}
480470

@@ -716,7 +706,7 @@ where
716706
let def: ModuleDefId = module.into();
717707
self.def_collector.def_map.modules[self.module_id].scope.define_def(def);
718708
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)]);
720710
res
721711
}
722712

@@ -776,7 +766,7 @@ where
776766
};
777767
self.def_collector.def_map.modules[self.module_id].scope.define_def(def);
778768
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)])
780770
}
781771

782772
fn collect_derives(&mut self, attrs: &Attrs, def: &raw::DefData) {

0 commit comments

Comments
 (0)