From fe56032f2f5b33d04236e9aa8dc9d05e493b56e8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 8 Jul 2016 18:29:09 +0300 Subject: [PATCH] Remove dead code --- src/cargo/lib.rs | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 746089548..2fd460e33 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -25,10 +25,9 @@ extern crate toml; extern crate url; use std::env; -use std::io::prelude::*; use std::io; use rustc_serialize::{Decodable, Encodable}; -use rustc_serialize::json::{self, Json}; +use rustc_serialize::json; use docopt::Docopt; use core::{Shell, MultiShell, ShellConfig, Verbosity, ColorConfig}; @@ -49,31 +48,6 @@ pub mod ops; pub mod sources; pub mod util; -pub fn execute_main( - exec: fn(T, U, &Config) -> CliResult>, - options_first: bool, - usage: &str) - where V: Encodable, T: Decodable, U: Decodable -{ - process::(|rest, shell| { - call_main(exec, shell, usage, rest, options_first) - }); -} - -pub fn call_main( - exec: fn(T, U, &Config) -> CliResult>, - shell: &Config, - usage: &str, - args: &[String], - options_first: bool) -> CliResult> - where V: Encodable, T: Decodable, U: Decodable -{ - let flags = try!(flags_from_args::(usage, args, options_first)); - let json = try!(json_from_stdin::()); - - exec(flags, json, shell) -} - pub fn execute_main_without_stdin( exec: fn(T, &Config) -> CliResult>, options_first: bool, @@ -250,20 +224,3 @@ fn flags_from_args(usage: &str, args: &[String], CliError::new(human(e.to_string()), code) }) } - -fn json_from_stdin() -> CliResult { - let mut reader = io::stdin(); - let mut input = String::new(); - try!(reader.read_to_string(&mut input).map_err(|_| { - CliError::new(human("Standard in did not exist or was not UTF-8"), 1) - })); - - let json = try!(Json::from_str(&input).map_err(|_| { - CliError::new(human("Could not parse standard in as JSON"), 1) - })); - let mut decoder = json::Decoder::new(json); - - Decodable::decode(&mut decoder).map_err(|_| { - CliError::new(human("Could not process standard in as input"), 1) - }) -} -- 2.39.5