From 1a358e203ef0cb0fcda7e6cc3369b30b3bf423ec Mon Sep 17 00:00:00 2001 From: CharlesChen0823 Date: Wed, 15 May 2024 09:25:54 +0800 Subject: [PATCH] cleanup (#11835) cleanup unneed code. Release Notes: - N/A --- crates/util/src/util.rs | 10 ---------- crates/workspace/src/persistence.rs | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/crates/util/src/util.rs b/crates/util/src/util.rs index e16d6ef1f6..5bbbc8f18a 100644 --- a/crates/util/src/util.rs +++ b/crates/util/src/util.rs @@ -431,16 +431,6 @@ pub fn asset_str(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(option: Option<(T, U)>) -> (Option, Option) { - match option { - Some((a, b)) => (Some(a), Some(b)), - None => (None, None), - } -} - /// Expands to an immediately-invoked function expression. Good for using the ? operator /// in functions which do not return an Option or Result. /// diff --git a/crates/workspace/src/persistence.rs b/crates/workspace/src/persistence.rs index e977166b00..830209aca2 100644 --- a/crates/workspace/src/persistence.rs +++ b/crates/workspace/src/persistence.rs @@ -12,7 +12,7 @@ use sqlez::{ statement::Statement, }; -use util::{unzip_option, ResultExt}; +use util::ResultExt; use uuid::Uuid; use crate::WorkspaceId; @@ -777,7 +777,7 @@ impl WorkspaceDb { children, flexes, } => { - let (parent_id, position) = unzip_option(parent); + let (parent_id, position) = parent.unzip(); let flex_string = flexes .as_ref() @@ -828,7 +828,7 @@ impl WorkspaceDb { ))?((workspace_id, pane.active))? .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!( INSERT INTO center_panes(pane_id, parent_group_id, position) VALUES (?, ?, ?)