Convert extension to String in and_then
@@ -190,8 +190,8 @@ fn try_save(path: &Path, text: &Rope, encoding: CharacterEncoding) -> io::Result
let tmp_extension = path
.extension()
- .and_then(|extension| extension.to_str())
- .map_or_else(|| "swp".to_string(), |extension| extension.to_string() + ".swp");
+ .and_then(|extension| extension.to_str()?.to_string().into())
+ .map_or_else(|| "swp".to_string(), |extension| extension + ".swp");
let tmp_path = &path.with_extension(tmp_extension);
let mut f = File::create(tmp_path)?;
