Skip to content

Commit 50f90ac

Browse files
committed
Fix clippy's
1 parent 6c03541 commit 50f90ac

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

codex-rs/tui/src/notifications/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub enum DesktopNotificationBackend {
2222

2323
impl DesktopNotificationBackend {
2424
pub fn osc9() -> Self {
25-
Self::Osc9(Osc9Backend::default())
25+
Self::Osc9(Osc9Backend)
2626
}
2727

2828
pub fn windows_toast() -> Self {
@@ -116,6 +116,7 @@ mod tests {
116116
assert_eq!(detect_backend().kind(), NotificationBackendKind::Osc9);
117117
}
118118

119+
#[cfg(target_os = "linux")]
119120
#[test]
120121
#[serial]
121122
fn selects_windows_toast_in_wsl_windows_terminal() {
@@ -126,4 +127,13 @@ mod tests {
126127
NotificationBackendKind::WindowsToast
127128
);
128129
}
130+
131+
#[cfg(not(target_os = "linux"))]
132+
#[test]
133+
#[serial]
134+
fn stays_on_osc9_outside_linux_even_with_wsl_env() {
135+
let _wsl_guard = EnvVarGuard::set("WSL_DISTRO_NAME", "Ubuntu");
136+
let _wt_guard = EnvVarGuard::set("WT_SESSION", "abc");
137+
assert_eq!(detect_backend().kind(), NotificationBackendKind::Osc9);
138+
}
129139
}

codex-rs/tui/src/notifications/windows_toast.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ $textNodes.Item(1).AppendChild($doc.CreateTextNode($bodyText)) | Out-Null
6767
$toast = [Windows.UI.Notifications.ToastNotification]::new($doc)
6868
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Codex').Show($toast)
6969
"#,
70-
encoded_title = encoded_title,
71-
encoded_body = encoded_body,
7270
)
7371
}
7472

@@ -102,11 +100,6 @@ pub fn escape_for_xml(input: &str) -> String {
102100

103101
#[cfg(test)]
104102
mod tests {
105-
use super::POWERSHELL_EXE;
106-
use super::WindowsToastBackend;
107-
use super::build_encoded_command;
108-
use super::build_ps_script;
109-
use super::encode_argument;
110103
use super::encode_script_for_powershell;
111104
use super::escape_for_xml;
112105
use pretty_assertions::assert_eq;
@@ -128,21 +121,6 @@ mod tests {
128121

129122
#[test]
130123
fn encodes_utf16le_for_powershell() {
131-
assert_eq!(encode_script_for_powershell("A"), "QQAA");
132-
}
133-
134-
fn format_command_line(fixed_args: &[&str], encoded_command: &str) -> String {
135-
let mut parts: Vec<String> = fixed_args
136-
.iter()
137-
.map(|arg| {
138-
if arg.chars().any(|c| c.is_whitespace()) {
139-
format!("\"{arg}\"")
140-
} else {
141-
(*arg).to_string()
142-
}
143-
})
144-
.collect();
145-
parts.push(format!("\"{encoded_command}\""));
146-
parts.join(" ")
124+
assert_eq!(encode_script_for_powershell("A"), "QQA=");
147125
}
148126
}

0 commit comments

Comments
 (0)