From 8afc7634d7019c68705b6acc53e782aba4b3cdec Mon Sep 17 00:00:00 2001 From: Ryan Osial Date: Sat, 27 Jan 2018 16:20:35 -0500 Subject: Support str as input to Builder::no_* functions Previously, only String was supported on these while other functions in Builder worked with both str and String --- src/lib.rs | 12 ++++++------ src/options.rs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c2315e05..9874b5dd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1191,22 +1191,22 @@ impl Builder { /// Don't derive `PartialEq` for a given type. Regular /// expressions are supported. - pub fn no_partialeq(mut self, arg: String) -> Builder { - self.options.no_partialeq_types.insert(arg); + pub fn no_partialeq>(mut self, arg: T) -> Builder { + self.options.no_partialeq_types.insert(arg.into()); self } /// Don't derive `Copy` for a given type. Regular /// expressions are supported. - pub fn no_copy(mut self, arg: String) -> Self { - self.options.no_copy_types.insert(arg); + pub fn no_copy>(mut self, arg: T) -> Self { + self.options.no_copy_types.insert(arg.into()); self } /// Don't derive `Hash` for a given type. Regular /// expressions are supported. - pub fn no_hash(mut self, arg: String) -> Builder { - self.options.no_hash_types.insert(arg); + pub fn no_hash>(mut self, arg: T) -> Builder { + self.options.no_hash_types.insert(arg.into()); self } } diff --git a/src/options.rs b/src/options.rs index 6d6e712c..4079603c 100644 --- a/src/options.rs +++ b/src/options.rs @@ -589,19 +589,19 @@ where if let Some(no_partialeq) = matches.values_of("no-partialeq") { for regex in no_partialeq { - builder = builder.no_partialeq(String::from(regex)); + builder = builder.no_partialeq(regex); } } if let Some(no_copy) = matches.values_of("no-copy") { for regex in no_copy { - builder = builder.no_copy(String::from(regex)); + builder = builder.no_copy(regex); } } if let Some(no_hash) = matches.values_of("no-hash") { for regex in no_hash { - builder = builder.no_hash(String::from(regex)); + builder = builder.no_hash(regex); } } -- cgit v1.2.3