/// **Known problems:** If creating the closure inside the closure has a side-
/// effect then moving the closure creation out will change when that side-
/// effect runs.
- /// See rust-lang/rust-clippy#1439 for more details.
+ /// See [#1439](https://github.com/rust-lang/rust-clippy/issues/1439) for more details.
///
/// **Example:**
/// ```rust,ignore
///
/// **Why is this bad?** It's unnecessary to create the closure.
///
- /// **Known problems:** rust-lang/rust-clippy#3071, rust-lang/rust-clippy#4002,
- /// rust-lang/rust-clippy#3942
+ /// **Known problems:** [#3071](https://github.com/rust-lang/rust-clippy/issues/3071),
+ /// [#3942](https://github.com/rust-lang/rust-clippy/issues/3942),
+ /// [#4002](https://github.com/rust-lang/rust-clippy/issues/4002)
///
///
/// **Example:**
let fn_ty = cx.typeck_results().expr_ty(caller);
- if matches!(fn_ty.kind, ty::FnDef(_, _) | ty::FnPtr(_) | ty::Closure(_, _));
+ if matches!(fn_ty.kind(), ty::FnDef(_, _) | ty::FnPtr(_) | ty::Closure(_, _));
if !type_is_unsafe_function(cx, fn_ty);
}
fn match_borrow_depth(lhs: Ty<'_>, rhs: Ty<'_>) -> bool {
- match (&lhs.kind, &rhs.kind) {
+ match (&lhs.kind(), &rhs.kind()) {
(ty::Ref(_, t1, mut1), ty::Ref(_, t2, mut2)) => mut1 == mut2 && match_borrow_depth(&t1, &t2),
(l, r) => !matches!((l, r), (ty::Ref(_, _, _), _) | (_, ty::Ref(_, _, _))),
}
}
fn match_types(lhs: Ty<'_>, rhs: Ty<'_>) -> bool {
- match (&lhs.kind, &rhs.kind) {
+ match (&lhs.kind(), &rhs.kind()) {
(ty::Bool, ty::Bool)
| (ty::Char, ty::Char)
| (ty::Int(_), ty::Int(_))
}
fn get_type_name(cx: &LateContext<'_>, ty: Ty<'_>) -> String {
- match ty.kind {
+ match ty.kind() {
ty::Adt(t, _) => cx.tcx.def_path_str(t.did),
ty::Ref(_, r, _) => get_type_name(cx, &r),
_ => ty.to_string(),