cleanup unneed code.

Release Notes:

- N/A
This commit is contained in:
CharlesChen0823
2024-05-14 18:25:54 -07:00
committed by GitHub
parent ba26acc1ed
commit 1a358e203e
2 changed files with 3 additions and 13 deletions
-10
View File
@@ -431,16 +431,6 @@ pub fn asset_str<A: rust_embed::RustEmbed>(path: &str) -> Cow<'static, str> {
} }
} }
// copy unstable standard feature option unzip
// https://github.com/rust-lang/rust/issues/87800
// Remove when this ship in Rust 1.66 or 1.67
pub fn unzip_option<T, U>(option: Option<(T, U)>) -> (Option<T>, Option<U>) {
match option {
Some((a, b)) => (Some(a), Some(b)),
None => (None, None),
}
}
/// Expands to an immediately-invoked function expression. Good for using the ? operator /// Expands to an immediately-invoked function expression. Good for using the ? operator
/// in functions which do not return an Option or Result. /// in functions which do not return an Option or Result.
/// ///
+3 -3
View File
@@ -12,7 +12,7 @@ use sqlez::{
statement::Statement, statement::Statement,
}; };
use util::{unzip_option, ResultExt}; use util::ResultExt;
use uuid::Uuid; use uuid::Uuid;
use crate::WorkspaceId; use crate::WorkspaceId;
@@ -777,7 +777,7 @@ impl WorkspaceDb {
children, children,
flexes, flexes,
} => { } => {
let (parent_id, position) = unzip_option(parent); let (parent_id, position) = parent.unzip();
let flex_string = flexes let flex_string = flexes
.as_ref() .as_ref()
@@ -828,7 +828,7 @@ impl WorkspaceDb {
))?((workspace_id, pane.active))? ))?((workspace_id, pane.active))?
.ok_or_else(|| anyhow!("Could not retrieve inserted pane_id"))?; .ok_or_else(|| anyhow!("Could not retrieve inserted pane_id"))?;
let (parent_id, order) = unzip_option(parent); let (parent_id, order) = parent.unzip();
conn.exec_bound(sql!( conn.exec_bound(sql!(
INSERT INTO center_panes(pane_id, parent_group_id, position) INSERT INTO center_panes(pane_id, parent_group_id, position)
VALUES (?, ?, ?) VALUES (?, ?, ?)