Skip to content

Commit

Permalink
Rollup merge of rust-lang#134161 - nnethercote:overhaul-token-cursors…
Browse files Browse the repository at this point in the history
…, r=spastorino

Overhaul token cursors

Some nice cleanups here.

r? `````@davidtwco`````
  • Loading branch information
jieyouxu authored Dec 18, 2024
2 parents 4d05825 + 1cb4dca commit 550d36d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/attrs/should_panic_without_expect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute) {
}

if let AttrArgs::Delimited(args) = &normal_attr.item.args
&& let mut tt_iter = args.tokens.trees()
&& let mut tt_iter = args.tokens.iter()
&& let Some(TokenTree::Token(
Token {
kind: TokenKind::Ident(sym::expected, _),
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/crate_in_macro_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ fn is_macro_export(attr: &Attribute) -> bool {

fn contains_unhygienic_crate_reference(tts: &TokenStream) -> Option<Span> {
let mut prev_is_dollar = false;
let mut cursor = tts.trees();
while let Some(curr) = cursor.next() {
let mut iter = tts.iter();
while let Some(curr) = iter.next() {
if !prev_is_dollar
&& let Some(span) = is_crate_keyword(curr)
&& let Some(next) = cursor.look_ahead(0)
&& let Some(next) = iter.peek()
&& is_token(next, &TokenKind::PathSep)
{
return Some(span);
Expand Down

0 comments on commit 550d36d

Please sign in to comment.