Skip to content

Commit

Permalink
Format + reduce warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
WilfSilver committed Aug 19, 2023
1 parent 334b1ce commit 9ff61ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/eww/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ fn parse_window_id_args(s: &str) -> Result<(String, VarName, DynVal)> {
// Parse the = first so we know if an id has not been given
let (name, value) = parse_var_update_arg(s)?;

let (id, var_name) = (&name.0).split_once(':').unwrap_or((&"", &name.0));
let (id, var_name) = name.0.split_once(':').unwrap_or(("", &name.0));

Ok((id.to_string(), var_name.into(), value))
}
Expand Down
9 changes: 5 additions & 4 deletions crates/eww/src/window_arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ impl WindowArguments {
size: WindowArguments::extract_value_from_args::<Coords>("size", &mut args)?,
monitor: WindowArguments::extract_value_from_args::<MonitorIdentifier>("screen", &mut args)?,
anchor: WindowArguments::extract_value_from_args::<AnchorPoint>("anchor", &mut args)?,
duration: WindowArguments::extract_value_from_args::<DynVal>("duration", &mut args)?.map(|x| x.as_duration()).transpose()?,
duration: WindowArguments::extract_value_from_args::<DynVal>("duration", &mut args)?
.map(|x| x.as_duration())
.transpose()?,
args,
};

Expand All @@ -63,7 +65,7 @@ impl WindowArguments {
local_variables.insert(VarName::from("screen"), DynVal::from(monitor));
}

local_variables.extend(self.args.clone().into_iter());
local_variables.extend(self.args.clone());

for attr in &window_def.expected_args {
let name = VarName::from(attr.name.clone());
Expand All @@ -73,8 +75,7 @@ impl WindowArguments {
}

if local_variables.len() != window_def.expected_args.len() {
let unexpected_vars: Vec<_> =
local_variables.iter().map(|(name, _)| name.clone()).filter(|n| !expected_args.contains(&n.0)).collect();
let unexpected_vars: Vec<_> = local_variables.keys().cloned().filter(|n| !expected_args.contains(&n.0)).collect();
bail!(
"variables {} unexpectedly defined when creating window with id '{}'",
unexpected_vars.join(", "),
Expand Down

0 comments on commit 9ff61ea

Please sign in to comment.