aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2020-09-03 08:39:04 -0700
committerDaniel Mueller <deso@posteo.net>2020-09-03 08:42:37 -0700
commitd180a0d828d46d7672031acbbd7a6f31bf5bf171 (patch)
tree88211b486e864eccd1802fb034a1045d1bdb4fe0 /src
parent23112b1854c67be8edab74fc0eb93ea57ba53f72 (diff)
downloadnitrocli-d180a0d828d46d7672031acbbd7a6f31bf5bf171.tar.gz
nitrocli-d180a0d828d46d7672031acbbd7a6f31bf5bf171.tar.bz2
Remove Stdio trait
With the switch from argparse over to structopt a while back the need for the Stdio trait that we used for abstracting over the different contexts vanished. With this change we remove the trait and its various implementations.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/main.rs b/src/main.rs
index b53358e..9e52613 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -85,25 +85,6 @@ const NITROCLI_NEW_ADMIN_PIN: &str = "NITROCLI_NEW_ADMIN_PIN";
const NITROCLI_NEW_USER_PIN: &str = "NITROCLI_NEW_USER_PIN";
const NITROCLI_PASSWORD: &str = "NITROCLI_PASSWORD";
-trait Stdio {
- fn stdio(&mut self) -> (&mut dyn io::Write, &mut dyn io::Write);
-}
-
-impl<'io> Stdio for RunCtx<'io> {
- fn stdio(&mut self) -> (&mut dyn io::Write, &mut dyn io::Write) {
- (self.stdout, self.stderr)
- }
-}
-
-impl<W> Stdio for (&mut W, &mut W)
-where
- W: io::Write,
-{
- fn stdio(&mut self) -> (&mut dyn io::Write, &mut dyn io::Write) {
- (self.0, self.1)
- }
-}
-
/// A command execution context that captures additional data pertaining
/// the command execution.
#[allow(missing_debug_implementations)]
@@ -126,12 +107,6 @@ pub struct ExecCtx<'io> {
pub config: config::Config,
}
-impl<'io> Stdio for ExecCtx<'io> {
- fn stdio(&mut self) -> (&mut dyn io::Write, &mut dyn io::Write) {
- (self.stdout, self.stderr)
- }
-}
-
/// Parse the command-line arguments and execute the selected command.
fn handle_arguments(ctx: &mut RunCtx<'_>, args: Vec<String>) -> anyhow::Result<()> {
use structopt::StructOpt;