Skip to content

Commit 58a4869

Browse files
committed
Add HygieneData::apply_mark.
This combines two `HygieneData::with` calls into one.
1 parent 4527a86 commit 58a4869

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/libsyntax_pos/hygiene.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ impl HygieneData {
265265
scope
266266
}
267267

268+
fn apply_mark(&mut self, ctxt: SyntaxContext, mark: Mark) -> SyntaxContext {
269+
assert_ne!(mark, Mark::root());
270+
self.apply_mark_with_transparency(ctxt, mark, self.default_transparency(mark))
271+
}
272+
268273
fn apply_mark_with_transparency(&mut self, ctxt: SyntaxContext, mark: Mark,
269274
transparency: Transparency) -> SyntaxContext {
270275
assert_ne!(mark, Mark::root());
@@ -407,10 +412,7 @@ impl SyntaxContext {
407412

408413
/// Extend a syntax context with a given mark and default transparency for that mark.
409414
pub fn apply_mark(self, mark: Mark) -> SyntaxContext {
410-
assert_ne!(mark, Mark::root());
411-
self.apply_mark_with_transparency(
412-
mark, HygieneData::with(|data| data.default_transparency(mark))
413-
)
415+
HygieneData::with(|data| data.apply_mark(self, mark))
414416
}
415417

416418
/// Extend a syntax context with a given mark and transparency

0 commit comments

Comments
 (0)