From ee42bcf67ea79d70bc5cd3502e33b1661d1c2e1a Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Mon, 7 Mar 2022 21:57:27 -0500 Subject: [PATCH] Fix all clippy warnings --- Cargo.toml | 2 +- src/main.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8b9c55d..4b86a79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,4 @@ -cargo-features = ["strip"] +# cargo-features = ["strip"] [package] name = "kakutils-rs" version = "0.1.0" diff --git a/src/main.rs b/src/main.rs index 51064ca..3c53b6d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,6 +167,9 @@ fn run() -> Result { } } +/// # Errors +/// +/// Will return `Err` if command fifo could not be opened or written to pub fn kak_exec(cmd: &str) -> Result<(), KakMessage> { let mut f = open_command_fifo()?; @@ -174,6 +177,9 @@ pub fn kak_exec(cmd: &str) -> Result<(), KakMessage> { f.flush().map_err(Into::into) } +/// # Errors +/// +/// Will return `Err` if command fifo could not be opened or written to pub fn kak_response(msg: &str) -> Result, KakMessage> { kak_exec(&format!( "echo -quoting shell -to-file {} -- {msg}", @@ -185,6 +191,9 @@ pub fn kak_response(msg: &str) -> Result, KakMessage> { Ok(selections) } +/// # Errors +/// +/// Will return `Err` if command fifo could not be opened pub fn open_command_fifo() -> Result, KakMessage> { OpenOptions::new() .write(true) @@ -194,6 +203,9 @@ pub fn open_command_fifo() -> Result, KakMessage> { .map_err(Into::into) } +/// # Errors +/// +/// Will return `Err` if requested environment variable is not unicode or not present pub fn get_var(var_name: &str) -> Result { env::var(var_name).map_err(|e| match e { env::VarError::NotPresent => {