about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_resolve/resolve_imports.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs
index 0eab53260a5..6667e489870 100644
--- a/src/librustc_resolve/resolve_imports.rs
+++ b/src/librustc_resolve/resolve_imports.rs
@@ -99,7 +99,7 @@ impl ImportDirective {
     }
 }
 
-#[derive(Clone, Copy)]
+#[derive(Clone, Default)]
 /// Records information about the resolution of a name in a module.
 pub struct NameResolution<'a> {
     /// The number of unresolved single imports that could define the name.
@@ -108,12 +108,6 @@ pub struct NameResolution<'a> {
     pub binding: Option<&'a NameBinding<'a>>,
 }
 
-impl<'a> Default for NameResolution<'a> {
-    fn default() -> Self {
-        NameResolution { outstanding_references: 0, binding: None }
-    }
-}
-
 impl<'a> NameResolution<'a> {
     pub fn result(&self, outstanding_globs: usize) -> ResolveResult<&'a NameBinding<'a>> {
         // If no unresolved imports (single or glob) can define the name, self.binding is final.
@@ -137,8 +131,8 @@ impl<'a> NameResolution<'a> {
     pub fn try_define(&mut self, binding: &'a NameBinding<'a>) -> Result<(), &'a NameBinding<'a>> {
         let is_prelude = |binding: &NameBinding| binding.defined_with(DefModifiers::PRELUDE);
         let old_binding = match self.binding {
-            Some(old_binding) if is_prelude(binding) && !is_prelude(old_binding) => return Ok(()),
-            Some(old_binding) if is_prelude(old_binding) == is_prelude(binding) => old_binding,
+            Some(_) if is_prelude(binding) => return Ok(()),
+            Some(old_binding) if !is_prelude(old_binding) => old_binding,
             _ => { self.binding = Some(binding); return Ok(()); }
         };