about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-01-30 16:57:49 +0100
committerGitHub <noreply@github.com>2024-01-30 16:57:49 +0100
commitb28e6f143eac39b88ff8bb4c45fea999ebdd8335 (patch)
tree50a3747a07885d375eb88d557798624ee2b94260 /src
parent6a1d34f32ab842cc781dab7d0c6e95008d3fdeaf (diff)
parent054e1e3aada8ab0dd08af1f2f8e7ee16139d96e7 (diff)
downloadrust-b28e6f143eac39b88ff8bb4c45fea999ebdd8335.tar.gz
rust-b28e6f143eac39b88ff8bb4c45fea999ebdd8335.zip
Rollup merge of #120342 - oli-obk:track_errors6, r=nnethercote
Remove various `has_errors` or `err_count` uses

follow up to https://github.com/rust-lang/rust/pull/119895

r? `@nnethercote` since you recently did something similar.

There are so many more of these, but I wanted to get a PR out instead of growing the commit list indefinitely. The commits all work on their own and can be reviewed commit by commit.
Diffstat (limited to 'src')
-rw-r--r--src/tools/clippy/clippy_lints/src/transmute/utils.rs18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/tools/clippy/clippy_lints/src/transmute/utils.rs b/src/tools/clippy/clippy_lints/src/transmute/utils.rs
index 1cf6cf8548a..7a7bb9f9c94 100644
--- a/src/tools/clippy/clippy_lints/src/transmute/utils.rs
+++ b/src/tools/clippy/clippy_lints/src/transmute/utils.rs
@@ -37,12 +37,6 @@ pub(super) fn check_cast<'tcx>(
     let inherited = Inherited::new(cx.tcx, local_def_id);
     let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, local_def_id);
 
-    // If we already have errors, we can't be sure we can pointer cast.
-    assert!(
-        !fn_ctxt.errors_reported_since_creation(),
-        "Newly created FnCtxt contained errors"
-    );
-
     if let Ok(check) = cast::CastCheck::new(
         &fn_ctxt,
         e,
@@ -53,17 +47,7 @@ pub(super) fn check_cast<'tcx>(
         DUMMY_SP,
         hir::Constness::NotConst,
     ) {
-        let res = check.do_check(&fn_ctxt);
-
-        // do_check's documentation says that it might return Ok and create
-        // errors in the fcx instead of returning Err in some cases. Those cases
-        // should be filtered out before getting here.
-        assert!(
-            !fn_ctxt.errors_reported_since_creation(),
-            "`fn_ctxt` contained errors after cast check!"
-        );
-
-        res.ok()
+        check.do_check(&fn_ctxt).ok()
     } else {
         None
     }