chore: clippy
This commit is contained in:
parent
3b70bc0265
commit
0847247c33
77 changed files with 865 additions and 1029 deletions
|
|
@ -148,19 +148,16 @@ where
|
|||
_dh: &DisplayHandle,
|
||||
_data_init: &mut DataInit<'_, D>,
|
||||
) {
|
||||
match request {
|
||||
zcosmic_output_head_v1::Request::Release => {
|
||||
let inner = state.output_configuration_state();
|
||||
if let Some(head) = inner
|
||||
.instances
|
||||
.iter_mut()
|
||||
.flat_map(|instance| instance.heads.iter_mut())
|
||||
.find(|head| head.extension_obj.as_ref().is_some_and(|o| o == obj))
|
||||
{
|
||||
head.extension_obj.take();
|
||||
}
|
||||
if let zcosmic_output_head_v1::Request::Release = request {
|
||||
let inner = state.output_configuration_state();
|
||||
if let Some(head) = inner
|
||||
.instances
|
||||
.iter_mut()
|
||||
.flat_map(|instance| instance.heads.iter_mut())
|
||||
.find(|head| head.extension_obj.as_ref().is_some_and(|o| o == obj))
|
||||
{
|
||||
head.extension_obj.take();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,13 +136,10 @@ where
|
|||
_dh: &DisplayHandle,
|
||||
_data_init: &mut DataInit<'_, D>,
|
||||
) {
|
||||
match request {
|
||||
zwlr_output_head_v1::Request::Release => {
|
||||
for instance in &mut state.output_configuration_state().instances {
|
||||
instance.heads.retain(|h| &h.obj != obj);
|
||||
}
|
||||
if let zwlr_output_head_v1::Request::Release = request {
|
||||
for instance in &mut state.output_configuration_state().instances {
|
||||
instance.heads.retain(|h| &h.obj != obj);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -173,16 +170,13 @@ where
|
|||
_dh: &DisplayHandle,
|
||||
_data_init: &mut DataInit<'_, D>,
|
||||
) {
|
||||
match request {
|
||||
zwlr_output_mode_v1::Request::Release => {
|
||||
let state = state.output_configuration_state();
|
||||
for instance in &mut state.instances {
|
||||
for head in &mut instance.heads {
|
||||
head.modes.retain(|mode| mode != obj)
|
||||
}
|
||||
if let zwlr_output_mode_v1::Request::Release = request {
|
||||
let state = state.output_configuration_state();
|
||||
for instance in &mut state.instances {
|
||||
for head in &mut instance.heads {
|
||||
head.modes.retain(|mode| mode != obj)
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -281,13 +275,11 @@ where
|
|||
.heads
|
||||
.iter_mut()
|
||||
.map(|(head, conf)| {
|
||||
let output = match {
|
||||
inner
|
||||
.instances
|
||||
.iter()
|
||||
.find_map(|instance| instance.heads.iter().find(|h| h.obj == *head))
|
||||
.map(|i| i.output.clone())
|
||||
} {
|
||||
let output = match inner
|
||||
.instances
|
||||
.iter()
|
||||
.find_map(|instance| instance.heads.iter().find(|h| h.obj == *head))
|
||||
.map(|i| i.output.clone()) {
|
||||
Some(o) => o,
|
||||
None => {
|
||||
return Err(zwlr_output_configuration_head_v1::Error::InvalidMode);
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ mod handlers;
|
|||
pub fn head_is_enabled(output: &Output) -> bool {
|
||||
output
|
||||
.user_data()
|
||||
.get::<OutputState>()
|
||||
.map_or(false, |inner| inner.lock().unwrap().enabled)
|
||||
.get::<OutputState>().is_some_and(|inner| inner.lock().unwrap().enabled)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -135,7 +134,7 @@ impl<'a> TryFrom<&'a mut PendingOutputConfigurationInner> for OutputConfiguratio
|
|||
wlr_mode
|
||||
.data::<Mode>()
|
||||
.cloned()
|
||||
.ok_or_else(|| zwlr_output_configuration_head_v1::Error::InvalidMode)?,
|
||||
.ok_or(zwlr_output_configuration_head_v1::Error::InvalidMode)?,
|
||||
)),
|
||||
Some(ModeConfiguration::Custom { size, refresh }) => {
|
||||
Some(ModeConfiguration::Custom { size, refresh })
|
||||
|
|
@ -283,7 +282,7 @@ where
|
|||
for instance in &mut self.instances {
|
||||
let mut removed_heads = Vec::new();
|
||||
for head in &mut instance.heads {
|
||||
if &head.output == &output {
|
||||
if head.output == output {
|
||||
if head.obj.version() < zwlr_output_head_v1::REQ_RELEASE_SINCE {
|
||||
removed_heads.push(head.obj.clone());
|
||||
}
|
||||
|
|
@ -435,7 +434,7 @@ where
|
|||
.map(|c| c == output_mode)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
instance.obj.current_mode(&*mode);
|
||||
instance.obj.current_mode(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue