Skip to content

Commit

Permalink
scmi: add missing lifetime
Browse files Browse the repository at this point in the history
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: rust-vmm#786
Signed-off-by: Stefano Garzarella <[email protected]>
  • Loading branch information
stefano-garzarella authored and epilys committed Dec 2, 2024
1 parent b96475f commit 937d28d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vhost-device-scmi/src/devices/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 937d28d

Please sign in to comment.