diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-06-17 17:47:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-17 17:47:28 +0200 |
commit | 29a391f60eb3aeecba4682dfdb38cdcd2a61b2b2 (patch) | |
tree | 658c84255ebb026c9cf417fcb7a19734a290ac53 /default-plugins | |
parent | 10b7f3a9812f1af0358513b3a8553754315a0e53 (diff) |
refactor(plugins): improve api (#2552)
* refactor(plugins): improve shim API
* style(fmt): rustfmt
Diffstat (limited to 'default-plugins')
-rw-r--r-- | default-plugins/fixture-plugin-for-tests/src/main.rs | 6 | ||||
-rw-r--r-- | default-plugins/strider/src/main.rs | 32 | ||||
-rw-r--r-- | default-plugins/strider/src/search/search_state.rs | 8 |
3 files changed, 21 insertions, 25 deletions
diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 9ce45f8af..20457f13f 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -219,11 +219,7 @@ impl ZellijPlugin for State { }, Event::SystemClipboardFailure => { // this is just to trigger the worker message - post_message_to( - "test", - "ping".to_owned(), - "gimme_back_my_payload".to_owned(), - ); + post_message_to("test", "ping", "gimme_back_my_payload"); }, _ => {}, } diff --git a/default-plugins/strider/src/main.rs b/default-plugins/strider/src/main.rs index 6cfaea81b..24d443d10 100644 --- a/default-plugins/strider/src/main.rs +++ b/default-plugins/strider/src/main.rs @@ -32,13 +32,13 @@ impl ZellijPlugin for State { ]); post_message_to( "file_name_search", - serde_json::to_string(&MessageToSearch::ScanFolder).unwrap(), - "".to_owned(), + &serde_json::to_string(&MessageToSearch::ScanFolder).unwrap(), + "", ); post_message_to( "file_contents_search", - serde_json::to_string(&MessageToSearch::ScanFolder).unwrap(), - "".to_owned(), + &serde_json::to_string(&MessageToSearch::ScanFolder).unwrap(), + "", ); self.search_state.loading = true; set_timeout(0.5); // for displaying loading animation @@ -192,13 +192,13 @@ impl ZellijPlugin for State { .collect(); post_message_to( "file_name_search", - serde_json::to_string(&MessageToSearch::FileSystemCreate).unwrap(), - serde_json::to_string(&paths).unwrap(), + &serde_json::to_string(&MessageToSearch::FileSystemCreate).unwrap(), + &serde_json::to_string(&paths).unwrap(), ); post_message_to( "file_contents_search", - serde_json::to_string(&MessageToSearch::FileSystemCreate).unwrap(), - serde_json::to_string(&paths).unwrap(), + &serde_json::to_string(&MessageToSearch::FileSystemCreate).unwrap(), + &serde_json::to_string(&paths).unwrap(), ); }, Event::FileSystemUpdate(paths) => { @@ -208,13 +208,13 @@ impl ZellijPlugin for State { .collect(); post_message_to( "file_name_search", - serde_json::to_string(&MessageToSearch::FileSystemUpdate).unwrap(), - serde_json::to_string(&paths).unwrap(), + &serde_json::to_string(&MessageToSearch::FileSystemUpdate).unwrap(), + &serde_json::to_string(&paths).unwrap(), ); post_message_to( "file_contents_search", - serde_json::to_string(&MessageToSearch::FileSystemUpdate).unwrap(), - serde_json::to_string(&paths).unwrap(), + &serde_json::to_string(&MessageToSearch::FileSystemUpdate).unwrap(), + &serde_json::to_string(&paths).unwrap(), ); }, Event::FileSystemDelete(paths) => { @@ -224,13 +224,13 @@ impl ZellijPlugin for State { .collect(); post_message_to( "file_name_search", - serde_json::to_string(&MessageToSearch::FileSystemDelete).unwrap(), - serde_json::to_string(&paths).unwrap(), + &serde_json::to_string(&MessageToSearch::FileSystemDelete).unwrap(), + &serde_json::to_string(&paths).unwrap(), ); post_message_to( "file_contents_search", - serde_json::to_string(&MessageToSearch::FileSystemDelete).unwrap(), - serde_json::to_string(&paths).unwrap(), + &serde_json::to_string(&MessageToSearch::FileSystemDelete).unwrap(), + &serde_json::to_string(&paths).unwrap(), ); }, _ => { diff --git a/default-plugins/strider/src/search/search_state.rs b/default-plugins/strider/src/search/search_state.rs index c8707cc9d..865a98e55 100644 --- a/default-plugins/strider/src/search/search_state.rs +++ b/default-plugins/strider/src/search/search_state.rs @@ -155,13 +155,13 @@ impl SearchState { if !self.search_term.is_empty() { post_message_to( "file_name_search", - serde_json::to_string(&MessageToSearch::Search).unwrap(), - "".to_owned(), + &serde_json::to_string(&MessageToSearch::Search).unwrap(), + "", ); post_message_to( "file_contents_search", - serde_json::to_string(&MessageToSearch::Search).unwrap(), - "".to_owned(), + &serde_json::to_string(&MessageToSearch::Search).unwrap(), + "", ); self.file_name_search_results.clear(); self.file_contents_search_results.clear(); |