}
declare_clippy_lint! {
- /// **What it does:** Checks for usage of `Box<T>` where an unboxed `T` would
+ /// ### What it does
+ /// Checks for usage of `Box<T>` where an unboxed `T` would
/// work fine.
///
- /// **Why is this bad?** This is an unnecessary allocation, and bad for
+ /// ### Why is this bad?
+ /// This is an unnecessary allocation, and bad for
/// performance. It is only necessary to allocate if you wish to move the box
/// into something.
///
- /// **Known problems:** None.
- ///
- /// **Example:**
+ /// ### Example
/// ```rust
/// # fn foo(bar: usize) {}
/// // Bad
struct EscapeDelegate<'a, 'tcx> {
cx: &'a LateContext<'tcx>,
set: HirIdSet,
- trait_self_ty: Option<Ty<'a>>,
+ trait_self_ty: Option<Ty<'tcx>>,
too_large_for_stack: u64,
}
// skip if there is a `self` parameter binding to a type
// that contains `Self` (i.e.: `self: Box<Self>`), see #4804
if let Some(trait_self_ty) = self.trait_self_ty {
- if map.name(cmt.hir_id) == kw::SelfLower && contains_ty(cmt.place.ty(), trait_self_ty) {
+ if map.name(cmt.hir_id) == kw::SelfLower && contains_ty(self.cx.tcx, cmt.place.ty(), trait_self_ty) {
return;
}
}