From 18e45459ef47accc8c32850d59d78063805635c2 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 14 Jul 2023 10:26:56 -0700 Subject: [PATCH] Remove redunant method We get this for free via std::fmt::Display --- examples/geojson_to_string.rs | 2 +- src/geojson.rs | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/examples/geojson_to_string.rs b/examples/geojson_to_string.rs index 350d4f5..72e5a1d 100644 --- a/examples/geojson_to_string.rs +++ b/examples/geojson_to_string.rs @@ -11,7 +11,7 @@ fn main() -> Result<(), Box> { let geojson: GeoJson = feature.into(); - println!("{}", &geojson.clone().to_string()?); + println!("{}", &geojson.to_string()); println!("{}", &geojson.to_string_pretty()?); Ok(()) diff --git a/src/geojson.rs b/src/geojson.rs index e06c509..75fae4c 100644 --- a/src/geojson.rs +++ b/src/geojson.rs @@ -234,13 +234,6 @@ impl GeoJson { serde_json::from_reader(rdr) } - /// Convenience wrapper for [serde_json::to_string()] - pub fn to_string(self) -> Result { - ::serde_json::to_string(&self) - .map_err(|err| Error::MalformedJson(err)) - .and_then(|s| Ok(s.to_string())) - } - /// Convenience wrapper for [serde_json::to_string_pretty()] pub fn to_string_pretty(self) -> Result { ::serde_json::to_string_pretty(&self)