aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tt
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-11-28 05:41:58 +0000
committerEdwin Cheng <[email protected]>2019-11-28 05:41:58 +0000
commit89fbd0db02693eabb82f0b189a08fe0ebe924550 (patch)
tree11e666b17bfa753f8d0f772ec73cb462fb597650 /crates/ra_tt
parent484acc8a61d599662ed63a4cbda091d38a982551 (diff)
Derive Hash for TokenTrees
Diffstat (limited to 'crates/ra_tt')
-rw-r--r--crates/ra_tt/src/lib.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs
index 20c251ff4..4c00b8f30 100644
--- a/crates/ra_tt/src/lib.rs
+++ b/crates/ra_tt/src/lib.rs
@@ -33,14 +33,14 @@ impl TokenId {
33 } 33 }
34} 34}
35 35
36#[derive(Debug, Clone, PartialEq, Eq)] 36#[derive(Debug, Clone, PartialEq, Eq, Hash)]
37pub enum TokenTree { 37pub enum TokenTree {
38 Leaf(Leaf), 38 Leaf(Leaf),
39 Subtree(Subtree), 39 Subtree(Subtree),
40} 40}
41impl_froms!(TokenTree: Leaf, Subtree); 41impl_froms!(TokenTree: Leaf, Subtree);
42 42
43#[derive(Debug, Clone, PartialEq, Eq)] 43#[derive(Debug, Clone, PartialEq, Eq, Hash)]
44pub enum Leaf { 44pub enum Leaf {
45 Literal(Literal), 45 Literal(Literal),
46 Punct(Punct), 46 Punct(Punct),
@@ -48,13 +48,13 @@ pub enum Leaf {
48} 48}
49impl_froms!(Leaf: Literal, Punct, Ident); 49impl_froms!(Leaf: Literal, Punct, Ident);
50 50
51#[derive(Debug, Clone, PartialEq, Eq)] 51#[derive(Debug, Clone, PartialEq, Eq, Hash)]
52pub struct Subtree { 52pub struct Subtree {
53 pub delimiter: Delimiter, 53 pub delimiter: Delimiter,
54 pub token_trees: Vec<TokenTree>, 54 pub token_trees: Vec<TokenTree>,
55} 55}
56 56
57#[derive(Clone, Copy, Debug, PartialEq, Eq)] 57#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
58pub enum Delimiter { 58pub enum Delimiter {
59 Parenthesis, 59 Parenthesis,
60 Brace, 60 Brace,
@@ -62,24 +62,24 @@ pub enum Delimiter {
62 None, 62 None,
63} 63}
64 64
65#[derive(Debug, Clone, PartialEq, Eq)] 65#[derive(Debug, Clone, PartialEq, Eq, Hash)]
66pub struct Literal { 66pub struct Literal {
67 pub text: SmolStr, 67 pub text: SmolStr,
68} 68}
69 69
70#[derive(Debug, Clone, Copy, PartialEq, Eq)] 70#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
71pub struct Punct { 71pub struct Punct {
72 pub char: char, 72 pub char: char,
73 pub spacing: Spacing, 73 pub spacing: Spacing,
74} 74}
75 75
76#[derive(Debug, Clone, Copy, PartialEq, Eq)] 76#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
77pub enum Spacing { 77pub enum Spacing {
78 Alone, 78 Alone,
79 Joint, 79 Joint,
80} 80}
81 81
82#[derive(Debug, Clone, PartialEq, Eq)] 82#[derive(Debug, Clone, PartialEq, Eq, Hash)]
83pub struct Ident { 83pub struct Ident {
84 pub text: SmolStr, 84 pub text: SmolStr,
85 pub id: TokenId, 85 pub id: TokenId,