Fix new warning from upcoming deprecation.

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 <https://github.com/rust-lang/rust/issues/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)
This commit is contained in:
Jeremy Whiting 2024-10-03 13:46:54 -06:00
parent ef00a32756
commit a386aaafb5

View file

@ -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)?;
@ -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)?;