scmi: add missing lifetime

rustc 1.83.0 (90b35a623 2024-11-26) emits 2 new warnings:

    warning: elided lifetime has a name
      --> vhost-device-scmi/src/devices/common.rs:69:60
       |
    69 |     fn extra<'a>(&'a self, allowed: &[&'a str]) -> HashSet<&str> {
       |              -- lifetime `'a` declared here                ^ this elided lifetime gets resolved as `'a`
       |
       = note: `#[warn(elided_named_lifetimes)]` on by default

    warning: elided lifetime has a name
      --> vhost-device-scmi/src/devices/common.rs:74:63
       |
    74 |     fn missing<'a>(&'a self, required: &[&'a str]) -> HashSet<&str> {
       |                -- lifetime `'a` declared here                 ^ this elided lifetime gets resolved as `'a`

    warning: `vhost-device-scmi` (bin "vhost-device-scmi") generated 2 warnings

Fixes: #786
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
Stefano Garzarella 2024-12-02 11:10:32 +01:00 committed by Manos Pitsidianakis
parent b96475f788
commit 937d28daee

View File

@ -66,12 +66,12 @@ impl DeviceProperties {
self.0.iter().map(|(n, _)| -> &str { n.as_str() }).collect()
}
fn extra<'a>(&'a self, allowed: &[&'a str]) -> HashSet<&str> {
fn extra<'a>(&'a self, allowed: &[&'a str]) -> HashSet<&'a str> {
let allowed_set: HashSet<&str> = HashSet::from_iter(allowed.iter().copied());
self.names().difference(&allowed_set).copied().collect()
}
fn missing<'a>(&'a self, required: &[&'a str]) -> HashSet<&str> {
fn missing<'a>(&'a self, required: &[&'a str]) -> HashSet<&'a str> {
let required_set: HashSet<&str> = HashSet::from_iter(required.iter().copied());
required_set.difference(&self.names()).copied().collect()
}