[Auto] lib/entry/edit: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:49:23 +02:00 committed by Matthias Beyer
parent 663bb7f6c0
commit 17de341b90

View file

@ -57,7 +57,7 @@ impl EditHeader for Entry {
fn edit_header(&mut self, rt: &Runtime) -> Result<()> { fn edit_header(&mut self, rt: &Runtime) -> Result<()> {
let mut header = ::toml::ser::to_string_pretty(self.get_header())?; let mut header = ::toml::ser::to_string_pretty(self.get_header())?;
let _ = edit_in_tmpfile(rt, &mut header)?; edit_in_tmpfile(rt, &mut header)?;
let header = ::toml::de::from_str(&header)?; let header = ::toml::de::from_str(&header)?;
*self.get_header_mut() = header; *self.get_header_mut() = header;
Ok(()) Ok(())
@ -65,7 +65,7 @@ impl EditHeader for Entry {
fn edit_header_and_content(&mut self, rt: &Runtime) -> Result<()> { fn edit_header_and_content(&mut self, rt: &Runtime) -> Result<()> {
let mut header_and_content = self.to_str()?; let mut header_and_content = self.to_str()?;
let _ = edit_in_tmpfile(rt, &mut header_and_content)?; edit_in_tmpfile(rt, &mut header_and_content)?;
self.replace_from_buffer(&header_and_content) self.replace_from_buffer(&header_and_content)
.context("Failed to replace header and content from buffer") .context("Failed to replace header and content from buffer")
.map_err(Error::from) .map_err(Error::from)
@ -79,7 +79,7 @@ pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> {
let editor = rt let editor = rt
.editor() .editor()
.context(err_msg("No editor"))? .context(err_msg("No editor"))?
.ok_or_else(|| Error::from(err_msg("No editor")))?; .ok_or_else(|| err_msg("No editor"))?;
edit_in_tmpfile_with_command(editor, s) edit_in_tmpfile_with_command(editor, s)
.context(EM::IO) .context(EM::IO)