]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/eval_order_dependence.rs
Add 'library/portable-simd/' from commit '1ce1c645cf27c4acdefe6ec8a11d1f0491954a99'
[rust.git] / src / tools / clippy / clippy_lints / src / eval_order_dependence.rs
index f72a1e446d55cd11bae944f8467dfd75a98dc6b2..1b56dd4b081775c685de8a295d1ce6c715f02ed3 100644 (file)
@@ -15,8 +15,8 @@
     /// order of sub-expressions.
     ///
     /// ### Why is this bad?
-    /// It is often confusing to read. In addition, the
-    /// sub-expression evaluation order for Rust is not well documented.
+    /// It is often confusing to read. As described [here](https://doc.rust-lang.org/reference/expressions.html?highlight=subexpression#evaluation-order-of-operands),
+    /// the operands of these expressions are evaluated before applying the effects of the expression.
     ///
     /// ### Known problems
     /// Code which intentionally depends on the evaluation
@@ -141,7 +141,7 @@ fn visit_expr(&mut self, e: &'tcx Expr<'_>) {
                 match typ.kind() {
                     ty::FnDef(..) | ty::FnPtr(_) => {
                         let sig = typ.fn_sig(self.cx.tcx);
-                        if let ty::Never = self.cx.tcx.erase_late_bound_regions(sig).output().kind() {
+                        if self.cx.tcx.erase_late_bound_regions(sig).output().kind() == &ty::Never {
                             self.report_diverging_sub_expr(e);
                         }
                     },