Skip to content

Commit

Permalink
Ignore clippy::if_then_panic lint
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Oct 1, 2021
1 parent cc670fd commit 26493b5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions futures-channel/src/lib.rs
Expand Up @@ -26,6 +26,7 @@
allow(dead_code, unused_assignments, unused_variables)
)
))]
#![allow(clippy::if_then_panic)]

#[cfg(not(futures_no_atomic_cas))]
#[cfg(feature = "alloc")]
Expand Down
21 changes: 12 additions & 9 deletions futures-test/src/assert.rs
Expand Up @@ -25,16 +25,19 @@ pub fn assert_is_unpin_stream<S: Stream + Unpin>(_: &mut S) {}
/// ```
#[macro_export]
macro_rules! assert_stream_pending {
($stream:expr) => {{
let mut stream = &mut $stream;
$crate::__private::assert::assert_is_unpin_stream(stream);
let stream = $crate::__private::Pin::new(stream);
let mut cx = $crate::task::noop_context();
let poll = $crate::__private::stream::Stream::poll_next(stream, &mut cx);
if poll.is_ready() {
panic!("assertion failed: stream is not pending");
($stream:expr) => {
#[allow(clippy::if_then_panic)]
{
let mut stream = &mut $stream;
$crate::__private::assert::assert_is_unpin_stream(stream);
let stream = $crate::__private::Pin::new(stream);
let mut cx = $crate::task::noop_context();
let poll = $crate::__private::stream::Stream::poll_next(stream, &mut cx);
if poll.is_ready() {
panic!("assertion failed: stream is not pending");
}
}
}};
};
}

/// Assert that the next poll to the provided stream will return
Expand Down
2 changes: 1 addition & 1 deletion futures-test/src/lib.rs
Expand Up @@ -14,7 +14,7 @@
allow(dead_code, unused_assignments, unused_variables)
)
))]

#![allow(clippy::if_then_panic)]
#[cfg(not(feature = "std"))]
compile_error!(
"`futures-test` must have the `std` feature activated, this is a default-active feature"
Expand Down

0 comments on commit 26493b5

Please sign in to comment.