# What is the idiomatic way to convert &str to String?

**URL:** <https://users.rust-lang.org/t/what-is-the-idiomatic-way-to-convert-str-to-string/12160>\
**Category:** help\
**Created:** [August 1, 2017, 10:35pm UTC](https://users.rust-lang.org/t/what-is-the-idiomatic-way-to-convert-str-to-string/12160 "2017-08-01T22:35:03Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Ophirr33](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/ophirr33/32/4463_2.png) [@Ophirr33](https://users.rust-lang.org/u/Ophirr33)\
**Post date:** [August 1, 2017, 11:02pm UTC](https://users.rust-lang.org/t/what-is-the-idiomatic-way-to-convert-str-to-string/12160/4 "2017-08-01T23:02:01Z")

</div>

[`to_string`](https://doc.rust-lang.org/src/collections/string.rs.html#2035-2040) just calls `String::from`, and [`String::from`](https://doc.rust-lang.org/src/collections/string.rs.html#2075-2079) just calls `to_owned`. They're all inlined, so there's no performance cost to any of them. Format might be more expensive since it goes through all of the formatting abstractions.

---

_[View the full topic](https://users.rust-lang.org/t/what-is-the-idiomatic-way-to-convert-str-to-string/12160)._
