aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/item_tree/pretty.rs4
-rw-r--r--crates/hir_def/src/nameres/collector.rs2
-rw-r--r--crates/hir_def/src/resolver.rs3
-rw-r--r--crates/hir_def/src/visibility.rs5
4 files changed, 6 insertions, 8 deletions
diff --git a/crates/hir_def/src/item_tree/pretty.rs b/crates/hir_def/src/item_tree/pretty.rs
index b1e1b70d0..e63bc8232 100644
--- a/crates/hir_def/src/item_tree/pretty.rs
+++ b/crates/hir_def/src/item_tree/pretty.rs
@@ -63,7 +63,7 @@ impl<'a> Printer<'a> {
63 fn blank(&mut self) { 63 fn blank(&mut self) {
64 let mut iter = self.buf.chars().rev().fuse(); 64 let mut iter = self.buf.chars().rev().fuse();
65 match (iter.next(), iter.next()) { 65 match (iter.next(), iter.next()) {
66 (Some('\n'), Some('\n')) | (Some('\n'), None) | (None, None) => {} 66 (Some('\n'), Some('\n') | None) | (None, None) => {}
67 (Some('\n'), Some(_)) => { 67 (Some('\n'), Some(_)) => {
68 self.buf.push('\n'); 68 self.buf.push('\n');
69 } 69 }
@@ -77,7 +77,7 @@ impl<'a> Printer<'a> {
77 77
78 fn whitespace(&mut self) { 78 fn whitespace(&mut self) {
79 match self.buf.chars().next_back() { 79 match self.buf.chars().next_back() {
80 None | Some('\n') | Some(' ') => {} 80 None | Some('\n' | ' ') => {}
81 _ => self.buf.push(' '), 81 _ => self.buf.push(' '),
82 } 82 }
83 } 83 }
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index fc2c50fb8..927a7b6e8 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -1260,7 +1260,7 @@ impl DefCollector<'_> {
1260 for directive in &self.unresolved_imports { 1260 for directive in &self.unresolved_imports {
1261 if let ImportSource::Import { id: import, use_tree } = &directive.import.source { 1261 if let ImportSource::Import { id: import, use_tree } = &directive.import.source {
1262 match (directive.import.path.segments().first(), &directive.import.path.kind) { 1262 match (directive.import.path.segments().first(), &directive.import.path.kind) {
1263 (Some(krate), PathKind::Plain) | (Some(krate), PathKind::Abs) => { 1263 (Some(krate), PathKind::Plain | PathKind::Abs) => {
1264 if diagnosed_extern_crates.contains(krate) { 1264 if diagnosed_extern_crates.contains(krate) {
1265 continue; 1265 continue;
1266 } 1266 }
diff --git a/crates/hir_def/src/resolver.rs b/crates/hir_def/src/resolver.rs
index d4681fa3e..47e56259f 100644
--- a/crates/hir_def/src/resolver.rs
+++ b/crates/hir_def/src/resolver.rs
@@ -605,8 +605,7 @@ fn to_value_ns(per_ns: PerNs) -> Option<ValueNs> {
605 ModuleDefId::ConstId(it) => ValueNs::ConstId(it), 605 ModuleDefId::ConstId(it) => ValueNs::ConstId(it),
606 ModuleDefId::StaticId(it) => ValueNs::StaticId(it), 606 ModuleDefId::StaticId(it) => ValueNs::StaticId(it),
607 607
608 ModuleDefId::AdtId(AdtId::EnumId(_)) 608 ModuleDefId::AdtId(AdtId::EnumId(_) | AdtId::UnionId(_))
609 | ModuleDefId::AdtId(AdtId::UnionId(_))
610 | ModuleDefId::TraitId(_) 609 | ModuleDefId::TraitId(_)
611 | ModuleDefId::TypeAliasId(_) 610 | ModuleDefId::TypeAliasId(_)
612 | ModuleDefId::BuiltinType(_) 611 | ModuleDefId::BuiltinType(_)
diff --git a/crates/hir_def/src/visibility.rs b/crates/hir_def/src/visibility.rs
index 83500f54e..aeb1e7726 100644
--- a/crates/hir_def/src/visibility.rs
+++ b/crates/hir_def/src/visibility.rs
@@ -172,9 +172,8 @@ impl Visibility {
172 /// visible in unrelated modules). 172 /// visible in unrelated modules).
173 pub(crate) fn max(self, other: Visibility, def_map: &DefMap) -> Option<Visibility> { 173 pub(crate) fn max(self, other: Visibility, def_map: &DefMap) -> Option<Visibility> {
174 match (self, other) { 174 match (self, other) {
175 (Visibility::Module(_), Visibility::Public) 175 (Visibility::Module(_) | Visibility::Public, Visibility::Public)
176 | (Visibility::Public, Visibility::Module(_)) 176 | (Visibility::Public, Visibility::Module(_)) => Some(Visibility::Public),
177 | (Visibility::Public, Visibility::Public) => Some(Visibility::Public),
178 (Visibility::Module(mod_a), Visibility::Module(mod_b)) => { 177 (Visibility::Module(mod_a), Visibility::Module(mod_b)) => {
179 if mod_a.krate != mod_b.krate { 178 if mod_a.krate != mod_b.krate {
180 return None; 179 return None;