Skip to content

Commit

Permalink
Fix new warning from upcoming deprecation.
Browse files Browse the repository at this point in the history
Since new rustc warns that ! will not decay into () anymore, we need
to help the compiler know what types it will be getting from method!
macro in 2 places where we call it from set_wifi_debug_mode.

https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html
has information about the new warning.

Here's the warning we hit without this change:

warning: this function depends on never type fallback being `()`
   --> src/manager/user.rs:189:5
    |
189 | /     async fn set_wifi_debug_mode(
190 | |         &self,
191 | |         mode: u32,
192 | |         buffer_size: u32,
193 | |         #[zbus(signal_context)] ctx: SignalContext<'_>,
194 | |     ) -> fdo::Result<()> {
    | |________________________^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #123748 <rust-lang/rust#123748>
    = help: specify the types explicitly
note: in edition 2024, the requirement `!: zbus::zvariant::Type` will fail
   --> src/manager/user.rs:40:14
    |
40  |             .call($method, &($($args,)*))
    |              ^^^^
...
195 |         method!(self, "SetWifiDebugMode", mode, buffer_size)?;
    |         ---------------------------------------------------- in this macro invocation
    = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default
    = note: this warning originates in the macro `method` (in Nightly builds, run with -Z macro-backtrace for more info)
  • Loading branch information
Jeremy Whiting committed Oct 8, 2024
1 parent ef00a32 commit a386aaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/manager/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl SteamOSManager {
buffer_size: u32,
#[zbus(signal_context)] ctx: SignalContext<'_>,
) -> fdo::Result<()> {
method!(self, "SetWifiDebugMode", mode, buffer_size)?;
let _: () = method!(self, "SetWifiDebugMode", mode, buffer_size)?;
self.wifi_debug_mode_state_changed(&ctx)
.await
.map_err(zbus_to_zbus_fdo)?;
Expand Down Expand Up @@ -466,7 +466,7 @@ impl WifiDebug1 {
options: HashMap<&str, zvariant::Value<'_>>,
#[zbus(signal_context)] ctx: SignalContext<'_>,
) -> fdo::Result<()> {
method!(self, "SetWifiDebugMode", mode, options)?;
let _: () = method!(self, "SetWifiDebugMode", mode, options)?;
self.wifi_debug_mode_state_changed(&ctx)
.await
.map_err(zbus_to_zbus_fdo)?;
Expand Down

0 comments on commit a386aaa

Please sign in to comment.