Skip to content

Commit

Permalink
Remove redunant method
Browse files Browse the repository at this point in the history
We get this for free via std::fmt::Display
  • Loading branch information
michaelkirk committed Jul 14, 2023
1 parent 5d033b6 commit 18e4545
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion examples/geojson_to_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() -> Result<(), Box<dyn Error>> {

let geojson: GeoJson = feature.into();

println!("{}", &geojson.clone().to_string()?);
println!("{}", &geojson.to_string());
println!("{}", &geojson.to_string_pretty()?);

Ok(())
Expand Down
7 changes: 0 additions & 7 deletions src/geojson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,6 @@ impl GeoJson {
serde_json::from_reader(rdr)
}

/// Convenience wrapper for [serde_json::to_string()]
pub fn to_string(self) -> Result<String> {
::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<String> {
::serde_json::to_string_pretty(&self)
Expand Down

0 comments on commit 18e4545

Please sign in to comment.