Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/mbe/src/token_map.rs')
-rw-r--r--crates/mbe/src/token_map.rs23
1 files changed, 2 insertions, 21 deletions
diff --git a/crates/mbe/src/token_map.rs b/crates/mbe/src/token_map.rs
index 3e8c4b2d6d..ff0c106cf2 100644
--- a/crates/mbe/src/token_map.rs
+++ b/crates/mbe/src/token_map.rs
@@ -5,7 +5,7 @@ use std::hash::Hash;
use parser::{SyntaxKind, T};
use syntax::{TextRange, TextSize};
-#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
enum TokenTextRange {
Token(TextRange),
Delimiter(TextRange),
@@ -26,27 +26,8 @@ impl TokenTextRange {
}
}
-#[derive(Debug, Clone, Default)]
-pub struct MappedSubTree {
- pub tree: tt::Subtree,
- pub map: TokenMap,
-}
-
-impl Eq for MappedSubTree {}
-impl PartialEq for MappedSubTree {
- fn eq(&self, other: &Self) -> bool {
- self.tree == other.tree && self.map == other.map
- }
-}
-
-impl Hash for MappedSubTree {
- fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
- self.tree.hash(state);
- }
-}
-
/// Maps `tt::TokenId` to the relative range of the original token.
-#[derive(Debug, PartialEq, Eq, Clone, Default)]
+#[derive(Debug, PartialEq, Eq, Clone, Default, Hash)]
pub struct TokenMap {
/// Maps `tt::TokenId` to the *relative* source range.
entries: Vec<(tt::TokenId, TokenTextRange)>,