aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Hackman <snickhackman@gmail.com>2019-08-18 20:23:40 -0400
committerNick Hackman <snickhackman@gmail.com>2019-08-18 20:23:40 -0400
commitb7d26c8a05e3d79a57f67b60ea938147a97094cd (patch)
treebf31ffe01aa2f6bdbb5313cdddba48703ac93926 /src
parent2bf0931b84064e79b7af0c37a5bb25c06fdedce0 (diff)
downloadmilf-rs-b7d26c8a05e3d79a57f67b60ea938147a97094cd.tar.gz
milf-rs-b7d26c8a05e3d79a57f67b60ea938147a97094cd.zip
Potential Solution to drop clippy errors
Calling the write!, the result that it returns doesn't matter or wasn't deemed as important and was dropped before. This was just removed and then the unused Result is ignored via clippy attribute. This is a plausible solution to get past the Clippy Error, but others may be more ideal.
Diffstat (limited to 'src')
-rw-r--r--src/ser.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/ser.rs b/src/ser.rs
index 05918e8..6a537e2 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -25,6 +25,8 @@
//! # fn main() {}
//! ```
+#![allow(unused_must_use)]
+
use std::cell::Cell;
use std::error;
use std::fmt::{self, Write};
@@ -422,7 +424,7 @@ impl<'a> Serializer<'a> {
fn display<T: fmt::Display>(&mut self, t: T, type_: &'static str) -> Result<(), Error> {
self.emit_key(type_)?;
- drop(write!(self.dst, "{}", t));
+ write!(self.dst, "{}", t);
if let State::Table { .. } = self.state {
self.dst.push_str("\n");
}
@@ -515,7 +517,7 @@ impl<'a> Serializer<'a> {
_ => false,
});
if ok {
- drop(write!(self.dst, "{}", key));
+ write!(self.dst, "{}", key);
} else {
self.emit_str(key, true)?;
}
@@ -647,7 +649,9 @@ impl<'a> Serializer<'a> {
'\u{d}' => self.dst.push_str("\\r"),
'\u{22}' => self.dst.push_str("\\\""),
'\u{5c}' => self.dst.push_str("\\\\"),
- c if c < '\u{1f}' => drop(write!(self.dst, "\\u{:04X}", ch as u32)),
+ c if c < '\u{1f}' => {
+ write!(self.dst, "\\u{:04X}", ch as u32);
+ }
ch => self.dst.push(ch),
}
}
@@ -750,15 +754,15 @@ macro_rules! serialize_float {
($this:expr, $v:expr) => {{
$this.emit_key("float")?;
if ($v.is_nan() || $v == 0.0) && $v.is_sign_negative() {
- drop(write!($this.dst, "-"));
+ write!($this.dst, "-");
}
if $v.is_nan() {
- drop(write!($this.dst, "nan"));
+ write!($this.dst, "nan");
} else {
- drop(write!($this.dst, "{}", $v));
+ write!($this.dst, "{}", $v);
}
if $v % 1.0 == 0.0 {
- drop(write!($this.dst, ".0"));
+ write!($this.dst, ".0");
}
if let State::Table { .. } = $this.state {
$this.dst.push_str("\n");