Fix dogfood
This commit is contained in:
parent
f26cf11fe8
commit
bf9b39ae7d
2 changed files with 7 additions and 2 deletions
|
@ -16,6 +16,10 @@ use rustc_middle::ty::TypeckResults;
|
||||||
use rustc_span::{sym, Symbol};
|
use rustc_span::{sym, Symbol};
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
|
/// Callback that is called when two expressions are not equal in the sense of `SpanlessEq`, but
|
||||||
|
/// other conditions would make them equal.
|
||||||
|
type SpanlessEqCallback<'a> = dyn FnMut(&Expr<'_>, &Expr<'_>) -> bool + 'a;
|
||||||
|
|
||||||
/// Type used to check whether two ast are the same. This is different from the
|
/// Type used to check whether two ast are the same. This is different from the
|
||||||
/// operator `==` on ast types as this operator would compare true equality with
|
/// operator `==` on ast types as this operator would compare true equality with
|
||||||
/// ID and span.
|
/// ID and span.
|
||||||
|
@ -26,7 +30,7 @@ pub struct SpanlessEq<'a, 'tcx> {
|
||||||
cx: &'a LateContext<'tcx>,
|
cx: &'a LateContext<'tcx>,
|
||||||
maybe_typeck_results: Option<(&'tcx TypeckResults<'tcx>, &'tcx TypeckResults<'tcx>)>,
|
maybe_typeck_results: Option<(&'tcx TypeckResults<'tcx>, &'tcx TypeckResults<'tcx>)>,
|
||||||
allow_side_effects: bool,
|
allow_side_effects: bool,
|
||||||
expr_fallback: Option<Box<dyn FnMut(&Expr<'_>, &Expr<'_>) -> bool + 'a>>,
|
expr_fallback: Option<Box<SpanlessEqCallback<'a>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
|
impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
|
||||||
|
|
|
@ -153,7 +153,8 @@ You can use tool lints to allow or deny lints from your code, eg.:
|
||||||
|
|
||||||
const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/new";
|
const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/new";
|
||||||
|
|
||||||
static ICE_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> = LazyLock::new(|| {
|
type PanicCallback = dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static;
|
||||||
|
static ICE_HOOK: LazyLock<Box<PanicCallback>> = LazyLock::new(|| {
|
||||||
let hook = panic::take_hook();
|
let hook = panic::take_hook();
|
||||||
panic::set_hook(Box::new(|info| report_clippy_ice(info, BUG_REPORT_URL)));
|
panic::set_hook(Box::new(|info| report_clippy_ice(info, BUG_REPORT_URL)));
|
||||||
hook
|
hook
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue