Fix DocOpt deserialization type bounds
authorYong Wen Chua <lawliet89@users.noreply.github.com>
Wed, 14 Feb 2018 01:58:20 +0000 (09:58 +0800)
committerYong Wen Chua <lawliet89@users.noreply.github.com>
Wed, 14 Feb 2018 01:58:20 +0000 (09:58 +0800)
This is wrt https://github.com/docopt/docopt.rs/pull/222

DocOpt does not support deserializing borrowed types.

This change was reverted in
https://github.com/docopt/docopt.rs/commit/7292a374e69afb192bb7aaa00f9d9f4afebc200d
because it broke crates like Cargo etc.

src/cargo/lib.rs

index d60792c7a74645f5bd278b72f3052e95d9b27730..41615e3d87d531966d1929040500cd368ffe423c 100644 (file)
@@ -40,7 +40,7 @@ extern crate core_foundation;
 
 use std::fmt;
 
-use serde::Deserialize;
+use serde::de::DeserializeOwned;
 use serde::ser;
 use docopt::Docopt;
 use failure::Error;
@@ -103,7 +103,7 @@ impl fmt::Display for VersionInfo {
     }
 }
 
-pub fn call_main_without_stdin<'de, Flags: Deserialize<'de>>(
+pub fn call_main_without_stdin<Flags: DeserializeOwned>(
             exec: fn(Flags, &mut Config) -> CliResult,
             config: &mut Config,
             usage: &str,