diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-01-27 22:05:19 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 22:05:19 -0600 |
commit | 8725aea78fb312d678fc17088eb8ba5c883c720c (patch) | |
tree | d7441788f8f8da5e8f0991325fc5f3779c404787 /src | |
parent | 4d1c95410d1b4ab55b1f7248ad11bbefda71bcc8 (diff) | |
parent | 8afc7634d7019c68705b6acc53e782aba4b3cdec (diff) |
Auto merge of #1237 - osialr:feature/str-flags, r=emilio
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
This tripped me up because `Builder::constified_enum_module` and `Builder::raw_line` worked with string slices but I got a compile error when I tried to use `Builder:;no_copy`
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 12 | ||||
-rw-r--r-- | src/options.rs | 6 |
2 files changed, 9 insertions, 9 deletions
@@ -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<T: Into<String>>(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<T: Into<String>>(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<T: Into<String>>(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); } } |