Skip to content

Commit 702b2d7

Browse files
committed
simplify self::Namespace::* import
1 parent 60d5d36 commit 702b2d7

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/librustc/hir/def.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use self::Namespace::*;
2-
31
use crate::hir;
42
use crate::hir::def_id::{DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE};
53
use crate::ty;
@@ -238,9 +236,9 @@ pub enum Namespace {
238236
impl Namespace {
239237
pub fn descr(self) -> &'static str {
240238
match self {
241-
TypeNS => "type",
242-
ValueNS => "value",
243-
MacroNS => "macro",
239+
Self::TypeNS => "type",
240+
Self::ValueNS => "value",
241+
Self::MacroNS => "macro",
244242
}
245243
}
246244
}
@@ -264,19 +262,19 @@ impl<T> ::std::ops::Index<Namespace> for PerNS<T> {
264262

265263
fn index(&self, ns: Namespace) -> &T {
266264
match ns {
267-
ValueNS => &self.value_ns,
268-
TypeNS => &self.type_ns,
269-
MacroNS => &self.macro_ns,
265+
Namespace::ValueNS => &self.value_ns,
266+
Namespace::TypeNS => &self.type_ns,
267+
Namespace::MacroNS => &self.macro_ns,
270268
}
271269
}
272270
}
273271

274272
impl<T> ::std::ops::IndexMut<Namespace> for PerNS<T> {
275273
fn index_mut(&mut self, ns: Namespace) -> &mut T {
276274
match ns {
277-
ValueNS => &mut self.value_ns,
278-
TypeNS => &mut self.type_ns,
279-
MacroNS => &mut self.macro_ns,
275+
Namespace::ValueNS => &mut self.value_ns,
276+
Namespace::TypeNS => &mut self.type_ns,
277+
Namespace::MacroNS => &mut self.macro_ns,
280278
}
281279
}
282280
}

0 commit comments

Comments
 (0)