diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-04 19:59:21 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-04 19:59:21 +0000 |
commit | de046bf4572a75cf534a2342358a422b2f18d01c (patch) | |
tree | 87f58e72537569806e689a6be4c404a496431360 /crates/hir_def/src/visibility.rs | |
parent | 4c1fcda0f8183060de5a341fffa2b30e65bdb52f (diff) | |
parent | 5d99ba1d9a5acf02a5cd50e456f164bd80b523b5 (diff) |
Merge #7559
7559: Make `ModPath`'s representation private r=jonas-schievink a=jonas-schievink
This lets us switch out the `Vec` for something more efficient
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/visibility.rs')
-rw-r--r-- | crates/hir_def/src/visibility.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/hir_def/src/visibility.rs b/crates/hir_def/src/visibility.rs index e79a91102..38da3132b 100644 --- a/crates/hir_def/src/visibility.rs +++ b/crates/hir_def/src/visibility.rs | |||
@@ -22,8 +22,7 @@ pub enum RawVisibility { | |||
22 | 22 | ||
23 | impl RawVisibility { | 23 | impl RawVisibility { |
24 | pub(crate) const fn private() -> RawVisibility { | 24 | pub(crate) const fn private() -> RawVisibility { |
25 | let path = ModPath { kind: PathKind::Super(0), segments: Vec::new() }; | 25 | RawVisibility::Module(ModPath::from_kind(PathKind::Super(0))) |
26 | RawVisibility::Module(path) | ||
27 | } | 26 | } |
28 | 27 | ||
29 | pub(crate) fn from_ast( | 28 | pub(crate) fn from_ast( |
@@ -59,15 +58,15 @@ impl RawVisibility { | |||
59 | RawVisibility::Module(path) | 58 | RawVisibility::Module(path) |
60 | } | 59 | } |
61 | ast::VisibilityKind::PubCrate => { | 60 | ast::VisibilityKind::PubCrate => { |
62 | let path = ModPath { kind: PathKind::Crate, segments: Vec::new() }; | 61 | let path = ModPath::from_kind(PathKind::Crate); |
63 | RawVisibility::Module(path) | 62 | RawVisibility::Module(path) |
64 | } | 63 | } |
65 | ast::VisibilityKind::PubSuper => { | 64 | ast::VisibilityKind::PubSuper => { |
66 | let path = ModPath { kind: PathKind::Super(1), segments: Vec::new() }; | 65 | let path = ModPath::from_kind(PathKind::Super(1)); |
67 | RawVisibility::Module(path) | 66 | RawVisibility::Module(path) |
68 | } | 67 | } |
69 | ast::VisibilityKind::PubSelf => { | 68 | ast::VisibilityKind::PubSelf => { |
70 | let path = ModPath { kind: PathKind::Plain, segments: Vec::new() }; | 69 | let path = ModPath::from_kind(PathKind::Plain); |
71 | RawVisibility::Module(path) | 70 | RawVisibility::Module(path) |
72 | } | 71 | } |
73 | ast::VisibilityKind::Pub => RawVisibility::Public, | 72 | ast::VisibilityKind::Pub => RawVisibility::Public, |