Skip to content

Commit

Permalink
attributes: remove use of non-MSRV-compliant Option::flatten
Browse files Browse the repository at this point in the history
PR #875 added code to `tracing-attributes` that uses `Option::flatten`,
which was only added to the standard library in Rust 1.40. This broke
our MSRV, but we missed it because the MSRV CI checks weren't working
correctly (fixed in #934).

This commit removes the use of `Option::flatten`, and replaces it with a
manual implementation. It's a little less pretty, but it builds on our
MSRV (1.39.0).
  • Loading branch information
hawkw committed Aug 17, 2020
1 parent 8fd9e76 commit 076c29e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tracing-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,11 @@ fn get_async_trait_info(block: &Block, block_is_async: bool) -> Option<AsyncTrai

None
})
.next()
.flatten();
.next();
let self_type = match self_type {
Some(x) => x,
None => None,
};

Some(AsyncTraitInfo {
name: fun.sig.ident.to_string(),
Expand Down

0 comments on commit 076c29e

Please sign in to comment.