Remove double ref

This commit is contained in:
Michael Hübner 2025-03-04 14:55:30 +01:00
parent c8b0c46d0e
commit 22994c97f6

View file

@ -736,44 +736,36 @@ impl GuiHandler {
Ok(false) Ok(false)
} }
pub fn decline_topgui(&self, gui_handler: &mut GuiHandler) -> Result<bool> { pub fn decline_topgui(&mut self) -> Result<bool> {
// workaround for unwanted borrowing behaviour inside decline function // workaround for unwanted borrowing behaviour inside decline function
let opt_topgui = self.top_ui.as_ref().cloned(); let opt_topgui = self.top_ui.as_ref().cloned();
if let Some(topgui) = opt_topgui { if let Some(topgui) = opt_topgui {
topgui.decline(gui_handler)?; topgui.decline(self)?;
return Ok(true); return Ok(true);
} }
Ok(false) Ok(false)
} }
pub fn next_tab_topgui( pub fn next_tab_topgui(&mut self, second_level: bool) -> Result<bool> {
&self,
gui_handler: &mut GuiHandler,
second_level: bool,
) -> Result<bool> {
// workaround for unwanted borrowing behaviour inside decline function // workaround for unwanted borrowing behaviour inside decline function
let opt_topgui = self.top_ui.as_ref().cloned(); let opt_topgui = self.top_ui.as_ref().cloned();
if let Some(topgui) = opt_topgui { if let Some(topgui) = opt_topgui {
topgui.next_tab(gui_handler, second_level)?; topgui.next_tab(self, second_level)?;
return Ok(true); return Ok(true);
} }
Ok(false) Ok(false)
} }
pub fn previous_tab_topgui( pub fn previous_tab_topgui(&mut self, second_level: bool) -> Result<bool> {
&self,
gui_handler: &mut GuiHandler,
second_level: bool,
) -> Result<bool> {
// workaround for unwanted borrowing behaviour inside decline function // workaround for unwanted borrowing behaviour inside decline function
let opt_topgui = self.top_ui.as_ref().cloned(); let opt_topgui = self.top_ui.as_ref().cloned();
if let Some(topgui) = opt_topgui { if let Some(topgui) = opt_topgui {
topgui.previous_tab(gui_handler, second_level)?; topgui.previous_tab(self, second_level)?;
return Ok(true); return Ok(true);
} }