This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suppress question_mark Clippy false positive
rust-lang/rust-clippy#7859 error: this block may be rewritten with the `?` operator --> src/ser.rs:871:9 | 871 | / if self.writer.write_all(s.as_bytes()).is_err() { 872 | | return Err(fmt::Error); 873 | | } | |_________^ help: replace it with: `self.writer.write_all(s.as_bytes())?;` | = note: `-D clippy::question-mark` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark Clippy's suggested replacement does not compile. error[E0277]: `?` couldn't convert the error to `std::fmt::Error` --> src/ser.rs:871:44 | 871 | self.writer.write_all(s.as_bytes())?; | ^ the trait `std::convert::From<std::io::Error>` is not implemented for `std::fmt::Error` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = note: required because of the requirements on the impl of `std::ops::FromResidual<std::result::Result<std::convert::Infallible, std::io::Error>>` for `std::result::Result<(), std::fmt::Error>` note: required by `std::ops::FromResidual::from_residual` --> nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/try_trait.rs:339:5 | 339 | fn from_residual(residual: R) -> Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Loading branch information
a23d8f2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacement would be
self.writer.write_all(s.as_bytes()).map_err(|_| fmt::Error)