Skip to content

Commit

Permalink
Treat select macro always as expression
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 17, 2021
1 parent 62f9924 commit 54c5d9c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,16 @@ impl VisitMut for ReplaceSelf {

fn visit_item_mut(&mut self, i: &mut Item) {
// Visit `macro_rules!` because locally defined macros can refer to
// `self`. Otherwise, do not recurse into nested items.
// `self`.
//
// Visit `futures::select` and similar select macros, which commonly
// appear syntactically like an item despite expanding to an expression.
//
// Otherwise, do not recurse into nested items.
if let Item::Macro(i) = i {
if i.mac.path.is_ident("macro_rules") {
if i.mac.path.is_ident("macro_rules")
|| i.mac.path.segments.last().unwrap().ident == "select"
{
self.visit_macro_mut(&mut i.mac)
}
}
Expand Down

0 comments on commit 54c5d9c

Please sign in to comment.