diff options
| author | Loïc BRANSTETT <lolo.branstett@numericable.fr> | 2022-03-22 11:43:05 +0100 |
|---|---|---|
| committer | Loïc BRANSTETT <lolo.branstett@numericable.fr> | 2022-04-03 21:29:57 +0200 |
| commit | ccff48f97b7a4438b9818f8ff0f60c1cd01cdbeb (patch) | |
| tree | a34d44a1df4bf8bd96e1f807416274343e11aa9b /compiler/rustc_serialize/src | |
| parent | 15a242a432c9c40a60def102209a5d40900b7b9d (diff) | |
| download | rust-ccff48f97b7a4438b9818f8ff0f60c1cd01cdbeb.tar.gz rust-ccff48f97b7a4438b9818f8ff0f60c1cd01cdbeb.zip | |
Replace every `String` in Target(Options) with `Cow<'static, str>`
Diffstat (limited to 'compiler/rustc_serialize/src')
| -rw-r--r-- | compiler/rustc_serialize/src/json.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_serialize/src/json.rs b/compiler/rustc_serialize/src/json.rs index 0cbea3a07a8..9847fde3c49 100644 --- a/compiler/rustc_serialize/src/json.rs +++ b/compiler/rustc_serialize/src/json.rs @@ -170,6 +170,7 @@ use self::JsonEvent::*; use self::ParserError::*; use self::ParserState::*; +use std::borrow::Cow; use std::collections::{BTreeMap, HashMap}; use std::mem::swap; use std::num::FpCategory as Fp; @@ -2196,6 +2197,12 @@ impl ToJson for string::String { } } +impl<'a> ToJson for Cow<'a, str> { + fn to_json(&self) -> Json { + Json::String(self.to_string()) + } +} + macro_rules! tuple_impl { // use variables to indicate the arity of the tuple ($($tyvar:ident),* ) => { |
