Fix all clippy warnings

This commit is contained in:
Austen Adler 2022-03-07 21:57:27 -05:00
parent 378622a00f
commit ee42bcf67e
2 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,4 @@
cargo-features = ["strip"]
# cargo-features = ["strip"]
[package]
name = "kakutils-rs"
version = "0.1.0"

View File

@ -167,6 +167,9 @@ fn run() -> Result<KakMessage, KakMessage> {
}
}
/// # 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<Vec<String>, KakMessage> {
kak_exec(&format!(
"echo -quoting shell -to-file {} -- {msg}",
@ -185,6 +191,9 @@ pub fn kak_response(msg: &str) -> Result<Vec<String>, KakMessage> {
Ok(selections)
}
/// # Errors
///
/// Will return `Err` if command fifo could not be opened
pub fn open_command_fifo() -> Result<BufWriter<File>, KakMessage> {
OpenOptions::new()
.write(true)
@ -194,6 +203,9 @@ pub fn open_command_fifo() -> Result<BufWriter<File>, 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<String, KakMessage> {
env::var(var_name).map_err(|e| match e {
env::VarError::NotPresent => {