Fix some clippy::pedantic warnings

This commit is contained in:
Vicki Pfau 2024-08-27 20:10:59 -07:00
parent d3152cb38d
commit 127eab4863
16 changed files with 161 additions and 166 deletions

View file

@ -10,7 +10,6 @@ use clap::{Parser, Subcommand};
use itertools::Itertools;
use std::collections::HashMap;
use std::io::Cursor;
use std::ops::Deref;
use steamos_manager::cec::HdmiCecState;
use steamos_manager::hardware::FanControlState;
use steamos_manager::power::{CPUScalingGovernor, GPUPerformanceLevel, GPUPowerProfile};
@ -165,20 +164,8 @@ enum Commands {
FactoryReset,
}
#[tokio::main]
async fn main() -> Result<()> {
// This is a command-line utility that calls api using dbus
// First set up which command line arguments we support
let args = Args::parse();
// Then get a connection to the service
let conn = Connection::session().await?;
// Then process arguments
match &args.command {
Commands::GetAllProperties => {
let proxy = IntrospectableProxy::builder(&conn)
async fn get_all_properties(conn: &Connection) -> Result<()> {
let proxy = IntrospectableProxy::builder(conn)
.destination("com.steampowered.SteamOSManager1")?
.path("/com/steampowered/SteamOSManager1")?
.build()
@ -212,9 +199,27 @@ async fn main() -> Result<()> {
}
for key in properties.keys().sorted() {
let value = &properties[key];
let val = value.deref();
let val = &**value;
println!("{key}: {val}");
}
Ok(())
}
#[allow(clippy::too_many_lines)]
#[tokio::main]
async fn main() -> Result<()> {
// This is a command-line utility that calls api using dbus
// First set up which command line arguments we support
let args = Args::parse();
// Then get a connection to the service
let conn = Connection::session().await?;
// Then process arguments
match &args.command {
Commands::GetAllProperties => {
get_all_properties(&conn).await?;
}
Commands::GetAlsCalibrationGain => {
let proxy = AmbientLightSensor1Proxy::new(&conn).await?;
@ -235,7 +240,7 @@ async fn main() -> Result<()> {
let proxy = FanControl1Proxy::new(&conn).await?;
let state = proxy.fan_control_state().await?;
match FanControlState::try_from(state) {
Ok(s) => println!("Fan control state: {}", s),
Ok(s) => println!("Fan control state: {s}"),
Err(_) => println!("Got unknown value {state} from backend"),
}
}
@ -284,7 +289,7 @@ async fn main() -> Result<()> {
println!("GPU Power Profile: {profile} {name}");
}
Err(_) => {
println!("Unknown GPU power profile or unable to get type from {profile}")
println!("Unknown GPU power profile or unable to get type from {profile}");
}
}
}
@ -304,7 +309,7 @@ async fn main() -> Result<()> {
let proxy = GpuPerformanceLevel1Proxy::new(&conn).await?;
let level = proxy.gpu_performance_level().await?;
match GPUPerformanceLevel::try_from(level.as_str()) {
Ok(l) => println!("GPU performance level: {}", l),
Ok(l) => println!("GPU performance level: {l}"),
Err(_) => println!("Got unknown value {level} from backend"),
}
}

View file

@ -81,7 +81,7 @@ impl<C: DaemonContext> Daemon<C> {
let token = CancellationToken::new();
let log_receiver = LogReceiver::new(connection.clone()).await?;
let remote_logger = LogLayer::new(&log_receiver).await;
let remote_logger = LogLayer::new(&log_receiver);
let subscriber = subscriber
.with(EnvFilter::from_default_env())
.with(remote_logger);
@ -90,8 +90,8 @@ impl<C: DaemonContext> Daemon<C> {
let mut daemon = Daemon {
services,
token,
channel,
connection,
channel,
};
daemon.add_service(log_receiver);
@ -134,11 +134,11 @@ impl<C: DaemonContext> Daemon<C> {
},
_ = tokio::signal::ctrl_c() => break Ok(()),
e = sigterm.recv() => match e {
Some(_) => Ok(()),
Some(()) => Ok(()),
None => Err(anyhow!("SIGTERM machine broke")),
},
e = sighup.recv() => match e {
Some(_) => {
Some(()) => {
match read_config(&context).await {
Ok(config) =>
context.reload(config, self).await,

View file

@ -77,7 +77,7 @@ impl HidNode {
if !matches!(
driver.file_name().and_then(|d| d.to_str()),
Some("sony") | Some("playstation")
Some("sony" | "playstation")
) {
debug!("Not a PlayStation controller");
return false;
@ -101,9 +101,8 @@ impl HidNode {
let mut dir = read_dir(path("/proc")).await?;
while let Some(entry) = dir.next_entry().await? {
let path = entry.path();
let proc = match path.file_name().map(|p| p.to_str()) {
Some(Some(p)) => p,
_ => continue,
let Some(Some(proc)) = path.file_name().map(|p| p.to_str()) else {
continue;
};
let _: u32 = match proc.parse() {
Ok(i) => i,
@ -147,7 +146,7 @@ impl HidNode {
async fn inhibit(&self) -> Result<()> {
let mut res = Ok(());
for node in self.get_nodes().await?.into_iter() {
for node in self.get_nodes().await? {
if let Err(err) = write_synced(node, b"1\n").await {
error!("Encountered error inhibiting: {err}");
res = Err(err);
@ -158,7 +157,7 @@ impl HidNode {
async fn uninhibit(&self) -> Result<()> {
let mut res = Ok(());
for node in self.get_nodes().await?.into_iter() {
for node in self.get_nodes().await? {
if let Err(err) = write_synced(node, b"0\n").await {
error!("Encountered error inhibiting: {err}");
res = Err(err);
@ -204,14 +203,13 @@ impl Inhibitor {
return Ok(false);
}
let id = match path
let Some(id) = path
.file_name()
.and_then(|f| f.to_str())
.and_then(|s| s.strip_prefix("hidraw"))
.and_then(|s| s.parse().ok())
{
Some(id) => id,
None => return Ok(false),
else {
return Ok(false);
};
let node = HidNode::new(id);
@ -240,12 +238,11 @@ impl Inhibitor {
const QSEC: Duration = Duration::from_millis(250);
debug!("Got event: {:08x}", event.mask);
if event.wd == self.dev_watch {
let path = match event.name {
Some(fname) => PathBuf::from(fname),
None => {
let path = if let Some(fname) = event.name {
PathBuf::from(fname)
} else {
error!("Got an event without an associated filename!");
return Err(anyhow!("Got an event without an associated filename"));
}
};
debug!("New device {} found", path.display());
let path = crate::path("/dev").join(path);
@ -315,7 +312,7 @@ mod test {
}
}
} => res,
_ = sleep(Duration::from_millis(500)) => false,
() = sleep(Duration::from_millis(500)) => false,
}
}

View file

@ -7,10 +7,12 @@
use zbus::fdo;
#[allow(clippy::needless_pass_by_value)]
pub fn to_zbus_fdo_error<S: ToString>(error: S) -> fdo::Error {
fdo::Error::Failed(error.to_string())
}
#[allow(clippy::needless_pass_by_value)]
pub fn to_zbus_error<S: ToString>(error: S) -> zbus::Error {
zbus::Error::Failure(error.to_string())
}

View file

@ -159,9 +159,10 @@ impl FanControl {
let jupiter_fan_control =
SystemdUnit::new(self.connection.clone(), service).await?;
let active = jupiter_fan_control.active().await?;
Ok(match active {
true => FanControlState::Os,
false => FanControlState::Bios,
Ok(if active {
FanControlState::Os
} else {
FanControlState::Bios
})
}
Some(ServiceConfig::Script {

View file

@ -143,7 +143,7 @@ impl JobManager {
let job = MirroredJob { job: proxy };
let object_path = self.add_job(job).await?;
self.mirrored_jobs.insert(name, object_path.to_owned());
self.mirrored_jobs.insert(name, object_path.clone());
Ok(object_path)
}
@ -186,9 +186,8 @@ impl Job {
}
fn send_signal(&self, signal: nix::sys::signal::Signal) -> Result<()> {
let pid = match self.process.id() {
Some(id) => id,
None => bail!("Unable to get pid from command, it likely finished running"),
let Some(pid) = self.process.id() else {
bail!("Unable to get pid from command, it likely finished running");
};
let pid: pid_t = match pid.try_into() {
Ok(pid) => pid,
@ -257,9 +256,10 @@ impl Job {
pub async fn cancel(&mut self, force: bool) -> fdo::Result<()> {
if self.try_wait().map_err(to_zbus_fdo_error)?.is_none() {
self.send_signal(match force {
true => Signal::SIGKILL,
false => Signal::SIGTERM,
self.send_signal(if force {
Signal::SIGKILL
} else {
Signal::SIGTERM
})
.map_err(to_zbus_fdo_error)?;
if self.paused {
@ -274,14 +274,12 @@ impl Job {
self.resume().await?;
}
let code = match self.wait_internal().await.map_err(to_zbus_fdo_error) {
Ok(v) => v,
Err(_) => {
return Err(fdo::Error::Failed("Unable to get exit code".to_string()));
}
};
if let Ok(code) = self.wait_internal().await.map_err(to_zbus_fdo_error) {
self.exit_code = Some(code);
Ok(code)
} else {
Err(fdo::Error::Failed("Unable to get exit code".to_string()))
}
}
}
@ -320,7 +318,7 @@ impl JobManagerService {
async fn handle_command(&mut self, command: JobManagerCommand) -> Result<()> {
match command {
JobManagerCommand::MirrorConnection(connection) => {
self.job_manager.mirror_connection(&connection).await?
self.job_manager.mirror_connection(&connection).await?;
}
JobManagerCommand::MirrorJob {
connection,

View file

@ -5,7 +5,7 @@
* SPDX-License-Identifier: MIT
*/
use anyhow::{anyhow, Result};
use anyhow::{bail, Result};
use async_trait::async_trait;
use config::builder::AsyncState;
use config::{AsyncSource, ConfigBuilder, ConfigError, FileFormat, Format, Map, Value};
@ -58,7 +58,7 @@ where
info!("Starting {}", Self::NAME);
let res = tokio::select! {
r = self.run() => r,
_ = token.cancelled() => Ok(()),
() = token.cancelled() => Ok(()),
};
if res.is_err() {
warn!(
@ -129,36 +129,35 @@ pub(crate) async fn write_synced<P: AsRef<Path>>(path: P, bytes: &[u8]) -> Resul
}
pub(crate) fn read_comm(pid: u32) -> Result<String> {
let comm = std::fs::read_to_string(path(format!("/proc/{}/comm", pid)))?;
let comm = std::fs::read_to_string(path(format!("/proc/{pid}/comm")))?;
Ok(comm.trim_end().to_string())
}
pub(crate) fn get_appid(pid: u32) -> Result<Option<u64>> {
let environ = std::fs::read_to_string(path(format!("/proc/{}/environ", pid)))?;
let environ = std::fs::read_to_string(path(format!("/proc/{pid}/environ")))?;
for env_var in environ.split('\0') {
let (key, value) = match env_var.split_once('=') {
Some((k, v)) => (k, v),
None => continue,
let Some((key, value)) = env_var.split_once('=') else {
continue;
};
if key != "SteamGameId" {
continue;
}
match value.parse() {
Ok(appid) => return Ok(Some(appid)),
Err(_) => break,
};
if let Ok(appid) = value.parse() {
return Ok(Some(appid));
}
break;
}
let stat = std::fs::read_to_string(path(format!("/proc/{}/stat", pid)))?;
let stat = match stat.rsplit_once(") ") {
Some((_, v)) => v,
None => return Ok(None),
let stat = std::fs::read_to_string(path(format!("/proc/{pid}/stat")))?;
let ppid: u32 = if let Some((_, stat)) = stat.rsplit_once(") ") {
if let Some(ppid) = stat.split(' ').nth(1) {
ppid.parse()?
} else {
bail!("stat data invalid");
}
} else {
return Ok(None);
};
let ppid = match stat.split(' ').nth(1) {
Some(ppid) => ppid,
None => return Err(anyhow!("stat data invalid")),
};
let ppid: u32 = ppid.parse()?;
if ppid > 1 {
get_appid(ppid)
} else {

View file

@ -91,7 +91,7 @@ impl SteamOSManager {
config = factory_reset ("PrepareFactoryReset") => {
let res = run_script(&config.script, &config.script_args).await;
Ok(match res {
Ok(_) => PrepareFactoryReset::RebootRequired as u32,
Ok(()) => PrepareFactoryReset::RebootRequired as u32,
Err(_) => PrepareFactoryReset::Unknown as u32,
})
}
@ -302,7 +302,10 @@ impl SteamOSManager {
Ok(mode) => mode,
Err(e) => return Err(fdo::Error::InvalidArgs(e.to_string())),
};
let buffer_size = match options.get("buffer_size").map(|v| v.downcast_ref::<u32>()) {
let buffer_size = match options
.get("buffer_size")
.map(zbus::zvariant::Value::downcast_ref)
{
Some(Ok(v)) => v,
None => 20000,
Some(Err(e)) => return Err(fdo::Error::InvalidArgs(e.to_string())),

View file

@ -506,6 +506,7 @@ impl WifiPowerManagement1 {
}
}
#[allow(clippy::too_many_lines)]
pub(crate) async fn create_interfaces(
session: Connection,
system: Connection,
@ -760,7 +761,7 @@ mod test {
async fn test_interface_missing<I: Interface>(connection: &Connection) -> bool {
let remote =
testing::InterfaceIntrospection::from_remote::<I, _>(connection, MANAGER_PATH).await;
return remote.is_err();
remote.is_err()
}
#[tokio::test]

View file

@ -123,8 +123,13 @@ async fn write_cpu_governor_sysfs_contents(contents: String) -> Result<()> {
let mut dir = fs::read_dir(path(CPU_PREFIX)).await?;
let mut wrote_stuff = false;
loop {
let base = match dir.next_entry().await? {
Some(entry) => {
let Some(entry) = dir.next_entry().await? else {
ensure!(
wrote_stuff,
"No data written, unable to find any policyX sysfs paths"
);
return Ok(());
};
let file_name = entry
.file_name()
.into_string()
@ -132,21 +137,12 @@ async fn write_cpu_governor_sysfs_contents(contents: String) -> Result<()> {
if !file_name.starts_with(CPU_POLICY_NAME) {
continue;
}
entry.path()
}
None => {
ensure!(
wrote_stuff,
"No data written, unable to find any policyX sysfs paths"
);
return Ok(());
}
};
let base = entry.path();
// Write contents to each one
wrote_stuff = true;
write_synced(base.join(CPU_SCALING_GOVERNOR_SUFFIX), contents.as_bytes())
.await
.inspect_err(|message| error!("Error writing to sysfs file: {message}"))?
.inspect_err(|message| error!("Error writing to sysfs file: {message}"))?;
}
}
@ -158,10 +154,8 @@ pub(crate) async fn get_gpu_power_profile() -> Result<GPUPowerProfile> {
// firmware support setting the value to no-op values.
let lines = contents.lines();
for line in lines {
let caps = GPU_POWER_PROFILE_REGEX.captures(line);
let caps = match caps {
Some(caps) => caps,
None => continue,
let Some(caps) = GPU_POWER_PROFILE_REGEX.captures(line) else {
continue;
};
let name = &caps["name"].to_lowercase();
@ -184,10 +178,8 @@ pub(crate) async fn get_available_gpu_power_profiles() -> Result<Vec<(u32, Strin
let mut map = Vec::new();
let lines = contents.lines();
for line in lines {
let caps = GPU_POWER_PROFILE_REGEX.captures(line);
let caps = match caps {
Some(caps) => caps,
None => continue,
let Some(caps) = GPU_POWER_PROFILE_REGEX.captures(line) else {
continue;
};
let value: u32 = caps["value"]
.parse()
@ -217,9 +209,7 @@ pub(crate) async fn set_gpu_power_profile(value: GPUPowerProfile) -> Result<()>
pub(crate) async fn get_available_gpu_performance_levels() -> Result<Vec<GPUPerformanceLevel>> {
let base = find_hwmon().await?;
if !try_exists(base.join(GPU_PERFORMANCE_LEVEL_SUFFIX)).await? {
Ok(Vec::new())
} else {
if try_exists(base.join(GPU_PERFORMANCE_LEVEL_SUFFIX)).await? {
Ok(vec![
GPUPerformanceLevel::Auto,
GPUPerformanceLevel::Low,
@ -227,6 +217,8 @@ pub(crate) async fn get_available_gpu_performance_levels() -> Result<Vec<GPUPerf
GPUPerformanceLevel::Manual,
GPUPerformanceLevel::ProfilePeak,
])
} else {
Ok(Vec::new())
}
}
@ -277,14 +269,12 @@ pub(crate) async fn set_cpu_scaling_governor(governor: CPUScalingGovernor) -> Re
pub(crate) async fn get_gpu_clocks_range() -> Result<(u32, u32)> {
let contents = read_gpu_sysfs_contents(GPU_CLOCK_LEVELS_SUFFIX).await?;
let lines = contents.lines();
let mut min = 1000000;
let mut min = 1_000_000;
let mut max = 0;
for line in lines {
let caps = GPU_CLOCK_LEVELS_REGEX.captures(line);
let caps = match caps {
Some(caps) => caps,
None => continue,
let Some(caps) = GPU_CLOCK_LEVELS_REGEX.captures(line) else {
continue;
};
let value: u32 = caps["value"]
.parse()
@ -381,7 +371,7 @@ pub(crate) async fn get_tdp_limit() -> Result<u32> {
let base = find_hwmon().await?;
let power1cap = fs::read_to_string(base.join(TDP_LIMIT1)).await?;
let power1cap: u32 = power1cap.trim_end().parse()?;
Ok(power1cap / 1000000)
Ok(power1cap / 1_000_000)
}
pub(crate) async fn set_tdp_limit(limit: u32) -> Result<()> {
@ -394,7 +384,7 @@ pub(crate) async fn set_tdp_limit(limit: u32) -> Result<()> {
write_synced(base.join(TDP_LIMIT1), data.as_bytes())
.await
.inspect_err(|message| {
error!("Error opening sysfs power1_cap file for writing TDP limits {message}")
error!("Error opening sysfs power1_cap file for writing TDP limits {message}");
})?;
if let Ok(mut power2file) = File::create(base.join(TDP_LIMIT2)).await {

View file

@ -33,7 +33,7 @@ pub async fn script_exit_code(
args: &[impl AsRef<OsStr>],
) -> Result<i32> {
let test = crate::testing::current();
let args: Vec<&OsStr> = args.iter().map(|arg| arg.as_ref()).collect();
let args: Vec<&OsStr> = args.iter().map(std::convert::AsRef::as_ref).collect();
let cb = test.process_cb.get();
cb(executable.as_ref(), args.as_ref()).map(|(res, _)| res)
}
@ -68,7 +68,7 @@ pub async fn script_output(
args: &[impl AsRef<OsStr>],
) -> Result<String> {
let test = crate::testing::current();
let args: Vec<&OsStr> = args.iter().map(|arg| arg.as_ref()).collect();
let args: Vec<&OsStr> = args.iter().map(std::convert::AsRef::as_ref).collect();
let cb = test.process_cb.get();
cb(executable.as_ref(), args.as_ref()).map(|(_, res)| res)
}

View file

@ -45,7 +45,7 @@ async fn setup_traces(base: &Path) -> Result<()> {
if !string.starts_with("flags") {
continue;
}
if let Some((_, rest)) = string.split_once(":") {
if let Some((_, rest)) = string.split_once(':') {
let mut flags = rest.split_whitespace();
if flags.any(|flag| flag == "split_lock_detect") {
fs::write(base.join("set_ftrace_filter"), "split_lock_warn").await?;
@ -196,7 +196,7 @@ mod test {
);
assert_eq!(
*map.get("appid").expect("appid"),
zvariant::Value::new(5678 as u64)
zvariant::Value::new(5678_u64)
);
let mut map = HashMap::new();
@ -212,7 +212,7 @@ mod test {
assert!(map.get("comm").is_none());
assert_eq!(
*map.get("appid").expect("appid"),
zvariant::Value::new(5678 as u64)
zvariant::Value::new(5678_u64)
);
}
@ -349,7 +349,7 @@ mod test {
assert_eq!(data.len(), 2);
assert_eq!(
data.get("appid").map(|v| v.downcast_ref()),
Some(Ok(5678 as u64))
Some(Ok(5678_u64))
);
assert_eq!(
data.get("comm").map(|v| v.downcast_ref()),

View file

@ -90,7 +90,7 @@ impl Service for LogReceiver {
}
impl LogLayer {
pub async fn new(receiver: &LogReceiver) -> LogLayer {
pub fn new(receiver: &LogReceiver) -> LogLayer {
LogLayer {
queue: receiver.sender.clone(),
}
@ -111,8 +111,7 @@ impl<S: Subscriber + for<'a> tracing_subscriber::registry::LookupSpan<'a>> Layer
prefix + "." + suffix
});
let level = match *event.metadata().level() {
Level::TRACE => 10,
Level::DEBUG => 10,
Level::TRACE | Level::DEBUG => 10,
Level::INFO => 20,
Level::WARN => 30,
Level::ERROR => 40,

View file

@ -401,13 +401,13 @@ pub mod test {
let unit = SystemdUnit::new(connection.clone(), "test.service")
.await
.expect("unit");
assert_eq!(unit.enable().await.unwrap(), true);
assert_eq!(unit.enable().await.unwrap(), false);
assert_eq!(unit.disable().await.unwrap(), true);
assert_eq!(unit.disable().await.unwrap(), false);
assert_eq!(unit.mask().await.unwrap(), true);
assert_eq!(unit.mask().await.unwrap(), false);
assert_eq!(unit.unmask().await.unwrap(), true);
assert_eq!(unit.unmask().await.unwrap(), false);
assert!(unit.enable().await.unwrap());
assert!(!unit.enable().await.unwrap());
assert!(unit.disable().await.unwrap());
assert!(!unit.disable().await.unwrap());
assert!(unit.mask().await.unwrap());
assert!(!unit.mask().await.unwrap());
assert!(unit.unmask().await.unwrap());
assert!(!unit.unmask().await.unwrap());
}
}

View file

@ -25,7 +25,7 @@ use zbus_xml::{Method, Node, Property};
use crate::platform::PlatformConfig;
thread_local! {
static TEST: RefCell<Option<Rc<Test>>> = RefCell::new(None);
static TEST: RefCell<Option<Rc<Test>>> = const { RefCell::new(None) };
}
#[macro_export]
@ -233,7 +233,7 @@ impl<'a> InterfaceIntrospection<'a> {
fn collect_methods(&self) -> HashMap<String, &Method<'_>> {
let mut map = HashMap::new();
for method in self.interface.methods().iter() {
for method in self.interface.methods() {
map.insert(method.name().to_string(), method);
}
map
@ -241,7 +241,7 @@ impl<'a> InterfaceIntrospection<'a> {
fn collect_properties(&self) -> HashMap<String, &Property<'_>> {
let mut map = HashMap::new();
for prop in self.interface.properties().iter() {
for prop in self.interface.properties() {
map.insert(prop.name().to_string(), prop);
}
map

View file

@ -51,7 +51,7 @@ impl Service for UdevMonitor {
.shutdown_receiver
.take()
.ok_or(anyhow!("UdevMonitor cannot be run twice"))?;
let mut handle = spawn(move || run_udev(ev_sender, shutdown_receiver));
let mut handle = spawn(move || run_udev(&ev_sender, &shutdown_receiver));
loop {
let handle = &mut handle;
@ -71,7 +71,7 @@ impl Service for UdevMonitor {
port.as_str(),
count,
)
.await?
.await?;
}
}
}
@ -111,7 +111,7 @@ impl UdevDbusObject {
) -> zbus::Result<()>;
}
fn run_udev(tx: UnboundedSender<UdevEvent>, rx: OwnedFd) -> Result<()> {
fn run_udev(tx: &UnboundedSender<UdevEvent>, rx: &OwnedFd) -> Result<()> {
let usb_monitor = MonitorBuilder::new()?
.match_subsystem_devtype("usb", "usb_interface")?
.listen()?;
@ -137,7 +137,7 @@ fn run_udev(tx: UnboundedSender<UdevEvent>, rx: OwnedFd) -> Result<()> {
let ev = iter
.next()
.ok_or(anyhow!("Poller said event was present, but it was not"))?;
process_usb_event(ev, &tx)?;
process_usb_event(&ev, tx)?;
}
Some(false) => (),
}
@ -149,7 +149,7 @@ fn run_udev(tx: UnboundedSender<UdevEvent>, rx: OwnedFd) -> Result<()> {
}
}
fn process_usb_event(ev: Event, tx: &UnboundedSender<UdevEvent>) -> Result<()> {
fn process_usb_event(ev: &Event, tx: &UnboundedSender<UdevEvent>) -> Result<()> {
debug!("Got USB event {ev:?}");
if ev.event_type() != EventType::Change {
return Ok(());