From 1ae74a34d11913620e86095fbd232ab5161d97e3 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Sat, 2 Jan 2021 13:17:15 -0600 Subject: [PATCH] style: Address clippy --- crates/typos/src/parser.rs | 2 +- src/report.rs | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/crates/typos/src/parser.rs b/crates/typos/src/parser.rs index f62bffb21..d4e57776c 100644 --- a/crates/typos/src/parser.rs +++ b/crates/typos/src/parser.rs @@ -26,7 +26,7 @@ impl<'p, 'd> ParserBuilder<'p, 'd> { pub fn dictionary<'d1>(self, dictionary: &'d1 dyn Dictionary) -> ParserBuilder<'p, 'd1> { ParserBuilder { tokenizer: self.tokenizer, - dictionary: dictionary, + dictionary, } } diff --git a/src/report.rs b/src/report.rs index 3d213cd08..08b2f288b 100644 --- a/src/report.rs +++ b/src/report.rs @@ -234,10 +234,21 @@ impl<'r> MessageStatus<'r> { impl<'r> Report for MessageStatus<'r> { fn report(&self, msg: Message) -> Result<(), std::io::Error> { - self.typos_found - .compare_and_swap(false, msg.is_correction(), atomic::Ordering::Relaxed); - self.errors_found - .compare_and_swap(false, msg.is_error(), atomic::Ordering::Relaxed); + let _ = self.typos_found.compare_exchange( + false, + msg.is_correction(), + atomic::Ordering::Relaxed, + atomic::Ordering::Relaxed, + ); + let _ = self + .errors_found + .compare_exchange( + false, + msg.is_error(), + atomic::Ordering::Relaxed, + atomic::Ordering::Relaxed, + ) + .unwrap(); self.reporter.report(msg) } }