You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the following warning is shown by the compiler, as the must_use attribute is being applied to a Future and not the actual function that is supposed to be called. A solution had been trialed in #342 but has been deemed not right.
warning: `must_use` attribute on `async` functions applies to the anonymous `Future` returned by the function, not the value within
Warning: --> rumqttc/src/eventloop.rs:124:5
|
124 | #[must_use = "Eventloop should be iterated over a loop to make progress"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125 | / pub async fn poll(&mut self) -> Result<Event, ConnectionError> {
126 | | if self.network.is_none() {
127 | | let (network, connack) = connect_or_cancel(&self.options, &self.cancel_rx).await?;
128 | | self.network = Some(network);
... |
143 | | }
144 | | }
| |_____- this attribute does nothing, the `Future`s returned by async functions are already `must_use`
|
= note: `#[warn(unused_attributes)]` on by default
The text was updated successfully, but these errors were encountered:
Both Futures and Results are already #[must_use]. This attribute should simply be removed, there's (unfortunately) no way to show this custom error instead of the ones for Future / Result when the user ignores the future, or its yielded value.
I suppose you could consider making the Event type #[must_use], with a somewhat different message.
Currently, the following warning is shown by the compiler, as the
must_use
attribute is being applied to aFuture
and not the actual function that is supposed to be called. A solution had been trialed in #342 but has been deemed not right.The text was updated successfully, but these errors were encountered: