Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/tt/src/lib.rs')
-rw-r--r--crates/tt/src/lib.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/crates/tt/src/lib.rs b/crates/tt/src/lib.rs
index 70843f0032..d80f618307 100644
--- a/crates/tt/src/lib.rs
+++ b/crates/tt/src/lib.rs
@@ -62,13 +62,11 @@ impl<S: Span> TokenTree<S> {
TokenTree::Subtree(s) => s,
}
}
- pub fn subtree_or_wrap2(self, span: DelimSpan<S>) -> Subtree<S> {
+
+ pub fn first_span(&self) -> S {
match self {
- TokenTree::Leaf(_) => Subtree {
- delimiter: Delimiter::invisible_delim_spanned(span),
- token_trees: vec![self],
- },
- TokenTree::Subtree(s) => s,
+ TokenTree::Leaf(l) => *l.span(),
+ TokenTree::Subtree(s) => s.delimiter.open,
}
}
}
@@ -141,11 +139,6 @@ impl<S: Span> Delimiter<S> {
pub const DUMMY_INVISIBLE: Self =
Self { open: S::DUMMY, close: S::DUMMY, kind: DelimiterKind::Invisible };
- // FIXME should not exist
- pub const fn dummy_invisible() -> Self {
- Self::DUMMY_INVISIBLE
- }
-
pub const fn invisible_spanned(span: S) -> Self {
Delimiter { open: span, close: span, kind: DelimiterKind::Invisible }
}