Skip to content

Commit

Permalink
refactor: Use Box<str> instead of String for tmux::Popup
Browse files Browse the repository at this point in the history
  • Loading branch information
iovis committed Jan 11, 2024
1 parent b86d0b1 commit eb0187e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/tmux/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ fn bind_settings(tmux_command: &mut Command, settings: &Settings) {
tmux_command
.arg("popup")
.arg("-w")
.arg(width)
.arg(width.as_ref())
.arg("-h")
.arg(height)
.arg(height.as_ref())
.arg("-b")
.arg("rounded")
.arg("-E");

if let Some(title) = title {
tmux_command.arg("-T").arg(title);
tmux_command.arg("-T").arg(title.as_ref());
}
} else {
tmux_command.arg("run");
Expand Down
10 changes: 5 additions & 5 deletions src/tmux/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct Popup {
pub title: Option<String>,
pub title: Option<Box<str>>,
#[serde(default = "default_popup_dimension")]
pub width: String,
pub width: Box<str>,
#[serde(default = "default_popup_dimension")]
pub height: String,
pub height: Box<str>,
}

fn default_popup_dimension() -> String {
"75%".to_string()
fn default_popup_dimension() -> Box<str> {
"75%".into()
}

0 comments on commit eb0187e

Please sign in to comment.