Skip to content

Commit

Permalink
Replace TokenStream::from_str with Literal::from_str
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 29, 2023
1 parent 28d6d25 commit 623d666
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,18 +458,9 @@ fn lit_indoc(token: TokenTree, mode: Macro, preserve_empty_first_line: bool) ->
close = &repr[end..],
);

match TokenStream::from_str(&repr)
.unwrap()
.into_iter()
.next()
.unwrap()
{
TokenTree::Literal(mut lit) => {
lit.set_span(span);
Ok(lit)
}
_ => unreachable!(),
}
let mut lit = Literal::from_str(&repr).unwrap();
lit.set_span(span);
Ok(lit)
}

fn require_empty_or_trailing_comma(input: &mut Peekable<TokenIter>) -> Result<()> {
Expand Down

0 comments on commit 623d666

Please sign in to comment.