refactor: Refactored a handful of Option calls to use take instead
This commit is contained in:
@@ -157,12 +157,11 @@ impl<'a> App<'a> {
|
|||||||
async fn check_for_radarr_prompt_action(&mut self) {
|
async fn check_for_radarr_prompt_action(&mut self) {
|
||||||
if self.data.radarr_data.prompt_confirm {
|
if self.data.radarr_data.prompt_confirm {
|
||||||
self.data.radarr_data.prompt_confirm = false;
|
self.data.radarr_data.prompt_confirm = false;
|
||||||
if let Some(radarr_event) = &self.data.radarr_data.prompt_confirm_action {
|
if let Some(radarr_event) = self.data.radarr_data.prompt_confirm_action.take() {
|
||||||
self
|
self
|
||||||
.dispatch_network_event(radarr_event.clone().into())
|
.dispatch_network_event(radarr_event.into())
|
||||||
.await;
|
.await;
|
||||||
self.should_refresh = true;
|
self.should_refresh = true;
|
||||||
self.data.radarr_data.prompt_confirm_action = None;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,10 +126,8 @@ pub fn handle_change_tab_left_right_keys(app: &mut App<'_>, key: Key) {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! search_table {
|
macro_rules! search_table {
|
||||||
($app:expr, $data_ref:ident, $error_block:expr) => {
|
($app:expr, $data_ref:ident, $error_block:expr) => {
|
||||||
let search_index = if let Some(search_str) = $app.data.radarr_data.search.as_ref() {
|
let search_index = if let Some(search_str) = $app.data.radarr_data.search.take() {
|
||||||
let search_string = search_str.text.clone().to_lowercase();
|
let search_string = search_str.text.to_lowercase();
|
||||||
|
|
||||||
$app.data.radarr_data.search = None;
|
|
||||||
|
|
||||||
$app
|
$app
|
||||||
.data
|
.data
|
||||||
@@ -153,10 +151,8 @@ macro_rules! search_table {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
($app:expr, $data_ref:ident, $error_block:expr, $option:ident) => {
|
($app:expr, $data_ref:ident, $error_block:expr, $option:ident) => {
|
||||||
let search_index = if let Some(search_str) = $app.data.radarr_data.search.as_ref() {
|
let search_index = if let Some(search_str) = $app.data.radarr_data.search.take() {
|
||||||
let search_string = search_str.text.clone().to_lowercase();
|
let search_string = search_str.text.to_lowercase();
|
||||||
|
|
||||||
$app.data.radarr_data.search = None;
|
|
||||||
|
|
||||||
$app
|
$app
|
||||||
.data
|
.data
|
||||||
|
|||||||
Reference in New Issue
Block a user