aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/clipboard.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-11-06 15:28:19 +0000
committerBlaž Hrastnik2021-11-06 15:28:19 +0000
commitf2b709a3c3a9cc036bfea46734efd7e4100eb34b (patch)
treead5f921f13659e5ba395442e13389af317ee81b0 /helix-view/src/clipboard.rs
parentcde57dae356021c6ca8c2a2ed68777bd9d0bc0b2 (diff)
parentf979bdc442ab3150a369ff8bee0703e90e32e2a4 (diff)
Merge branch 'master' into debug
Diffstat (limited to 'helix-view/src/clipboard.rs')
-rw-r--r--helix-view/src/clipboard.rs22
1 files changed, 6 insertions, 16 deletions
diff --git a/helix-view/src/clipboard.rs b/helix-view/src/clipboard.rs
index a11224ac..a492652d 100644
--- a/helix-view/src/clipboard.rs
+++ b/helix-view/src/clipboard.rs
@@ -116,7 +116,7 @@ pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
}
} else {
#[cfg(target_os = "windows")]
- return Box::new(provider::WindowsProvider::new());
+ return Box::new(provider::WindowsProvider::default());
#[cfg(not(target_os = "windows"))]
return Box::new(provider::NopProvider::new());
@@ -145,15 +145,15 @@ mod provider {
use anyhow::{bail, Context as _, Result};
use std::borrow::Cow;
+ #[cfg(not(target_os = "windows"))]
#[derive(Debug)]
pub struct NopProvider {
buf: String,
primary_buf: String,
}
+ #[cfg(not(target_os = "windows"))]
impl NopProvider {
- #[allow(dead_code)]
- // Only dead_code on Windows.
pub fn new() -> Self {
Self {
buf: String::new(),
@@ -162,6 +162,7 @@ mod provider {
}
}
+ #[cfg(not(target_os = "windows"))]
impl ClipboardProvider for NopProvider {
fn name(&self) -> Cow<str> {
Cow::Borrowed("none")
@@ -186,19 +187,8 @@ mod provider {
}
#[cfg(target_os = "windows")]
- #[derive(Debug)]
- pub struct WindowsProvider {
- selection_buf: String,
- }
-
- #[cfg(target_os = "windows")]
- impl WindowsProvider {
- pub fn new() -> Self {
- Self {
- selection_buf: String::new(),
- }
- }
- }
+ #[derive(Default, Debug)]
+ pub struct WindowsProvider;
#[cfg(target_os = "windows")]
impl ClipboardProvider for WindowsProvider {