diff --git a/tests/test_lit.rs b/tests/test_lit.rs index 6c398da4d8..2c5c929cfd 100644 --- a/tests/test_lit.rs +++ b/tests/test_lit.rs @@ -14,13 +14,12 @@ use std::str::FromStr; use syn::{Lit, LitFloat, LitInt, LitStr}; fn lit(s: &str) -> Lit { - match TokenStream::from_str(s) - .unwrap() - .into_iter() - .next() - .unwrap() - { - TokenTree::Literal(lit) => Lit::new(lit), + let mut tokens = TokenStream::from_str(s).unwrap().into_iter(); + match tokens.next().unwrap() { + TokenTree::Literal(lit) => { + assert!(tokens.next().is_none()); + Lit::new(lit) + } _ => panic!(), } }