diff --git a/src/command_builder.rs b/src/command_builder.rs index 0da1c6a..708a703 100644 --- a/src/command_builder.rs +++ b/src/command_builder.rs @@ -1,12 +1,7 @@ -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result}; use std::{ - collections::VecDeque, env, - ffi::OsStr, fmt::Display, - fs::{File, OpenOptions}, - os::unix::process::CommandExt, - path::PathBuf, process::{Child, Command, Stdio}, }; @@ -77,20 +72,20 @@ impl CommandBuilder { Ok(command) } - pub fn exec_get_stdout(mut self) -> Result { + pub fn exec_get_stdout(self) -> Result { Ok(String::from_utf8(self.build()?.output()?.stdout)?) } - pub fn exec(mut self) -> Result<()> { + pub fn exec(self) -> Result<()> { self.build()?.spawn()?.wait()?; Ok(()) } - pub fn spawn(mut self) -> Result<(Child)> { + pub fn spawn(self) -> Result { Ok(self.build()?.spawn()?) } - pub fn exec_redirect_stdout(mut self, stdio: Stdio) -> Result<()> { + pub fn exec_redirect_stdout(self, stdio: Stdio) -> Result<()> { self.build()?.stdout(stdio).spawn()?.wait()?; Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 561f014..99c221c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,3 @@ -#![allow(unused)] - use std::{ fs::{File, OpenOptions}, path::PathBuf, diff --git a/src/scripts/postgres.rs b/src/scripts/postgres.rs index 5e23c93..30e7e2c 100644 --- a/src/scripts/postgres.rs +++ b/src/scripts/postgres.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context, Result}; +use anyhow::{anyhow, Result}; use std::{ fs::File, path::{Path, PathBuf}, @@ -37,7 +37,7 @@ fn get_containers(container: &str) -> Result<[String; 2]> { } pub fn import(container: &str, file: &Path) -> Result<()> { - let [db_container, app_containers] = get_containers(container)?; + let [db_container, _] = get_containers(container)?; let dump_file = file.to_string_lossy(); eprintln!("stopping all containers");