Skip to content

Commit 89fbd0d

Browse files
committed
Derive Hash for TokenTrees
1 parent 484acc8 commit 89fbd0d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

crates/ra_tt/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,53 +33,53 @@ impl TokenId {
3333
}
3434
}
3535

36-
#[derive(Debug, Clone, PartialEq, Eq)]
36+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3737
pub enum TokenTree {
3838
Leaf(Leaf),
3939
Subtree(Subtree),
4040
}
4141
impl_froms!(TokenTree: Leaf, Subtree);
4242

43-
#[derive(Debug, Clone, PartialEq, Eq)]
43+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4444
pub enum Leaf {
4545
Literal(Literal),
4646
Punct(Punct),
4747
Ident(Ident),
4848
}
4949
impl_froms!(Leaf: Literal, Punct, Ident);
5050

51-
#[derive(Debug, Clone, PartialEq, Eq)]
51+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5252
pub struct Subtree {
5353
pub delimiter: Delimiter,
5454
pub token_trees: Vec<TokenTree>,
5555
}
5656

57-
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
5858
pub enum Delimiter {
5959
Parenthesis,
6060
Brace,
6161
Bracket,
6262
None,
6363
}
6464

65-
#[derive(Debug, Clone, PartialEq, Eq)]
65+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6666
pub struct Literal {
6767
pub text: SmolStr,
6868
}
6969

70-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
70+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7171
pub struct Punct {
7272
pub char: char,
7373
pub spacing: Spacing,
7474
}
7575

76-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
76+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7777
pub enum Spacing {
7878
Alone,
7979
Joint,
8080
}
8181

82-
#[derive(Debug, Clone, PartialEq, Eq)]
82+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
8383
pub struct Ident {
8484
pub text: SmolStr,
8585
pub id: TokenId,

0 commit comments

Comments
 (0)