Skip to content

Commit 0f7a18b

Browse files
committed
remove useless lifetimes on LateLintPass impl methods
1 parent 5beeb1e commit 0f7a18b

File tree

9 files changed

+90
-118
lines changed

9 files changed

+90
-118
lines changed

src/librustc_lint/bad_style.rs

+22-32
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl LintPass for NonCamelCaseTypes {
100100
}
101101

102102
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCamelCaseTypes {
103-
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item) {
103+
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
104104
let extern_repr_count = it.attrs
105105
.iter()
106106
.filter(|attr| {
@@ -133,9 +133,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCamelCaseTypes {
133133
}
134134
}
135135

136-
fn check_generics(&mut self,
137-
cx: &LateContext<'a, 'tcx>,
138-
it: &'tcx hir::Generics) {
136+
fn check_generics(&mut self, cx: &LateContext, it: &hir::Generics) {
139137
for gen in it.ty_params.iter() {
140138
self.check_case(cx, "type parameter", gen.name, gen.span);
141139
}
@@ -229,7 +227,7 @@ impl LintPass for NonSnakeCase {
229227
}
230228

231229
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
232-
fn check_crate(&mut self, cx: &LateContext<'a, 'tcx>, cr: &'tcx hir::Crate) {
230+
fn check_crate(&mut self, cx: &LateContext, cr: &hir::Crate) {
233231
let attr_crate_name = cr.attrs
234232
.iter()
235233
.find(|at| at.check_name("crate_name"))
@@ -242,12 +240,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
242240
}
243241

244242
fn check_fn(&mut self,
245-
cx: &LateContext<'a, 'tcx>,
246-
fk: FnKind,
247-
_: &'tcx hir::FnDecl,
248-
_: &'tcx hir::Expr,
249-
span: Span,
250-
id: ast::NodeId) {
243+
cx: &LateContext,
244+
fk: FnKind,
245+
_: &hir::FnDecl,
246+
_: &hir::Expr,
247+
span: Span,
248+
id: ast::NodeId) {
251249
match fk {
252250
FnKind::Method(name, ..) => {
253251
match method_context(cx, id, span) {
@@ -267,15 +265,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
267265
}
268266
}
269267

270-
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item) {
268+
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
271269
if let hir::ItemMod(_) = it.node {
272270
self.check_snake_case(cx, "module", &it.name.as_str(), Some(it.span));
273271
}
274272
}
275273

276-
fn check_trait_item(&mut self,
277-
cx: &LateContext<'a, 'tcx>,
278-
trait_item: &'tcx hir::TraitItem) {
274+
fn check_trait_item(&mut self, cx: &LateContext, trait_item: &hir::TraitItem) {
279275
if let hir::MethodTraitItem(_, None) = trait_item.node {
280276
self.check_snake_case(cx,
281277
"trait method",
@@ -284,16 +280,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
284280
}
285281
}
286282

287-
fn check_lifetime_def(&mut self,
288-
cx: &LateContext<'a, 'tcx>,
289-
t: &'tcx hir::LifetimeDef) {
283+
fn check_lifetime_def(&mut self, cx: &LateContext, t: &hir::LifetimeDef) {
290284
self.check_snake_case(cx,
291285
"lifetime",
292286
&t.lifetime.name.as_str(),
293287
Some(t.lifetime.span));
294288
}
295289

296-
fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, p: &'tcx hir::Pat) {
290+
fn check_pat(&mut self, cx: &LateContext, p: &hir::Pat) {
297291
// Exclude parameter names from foreign functions
298292
let parent_node = cx.tcx.map.get_parent_node(p.id);
299293
if let hir::map::NodeForeignItem(item) = cx.tcx.map.get(parent_node) {
@@ -308,11 +302,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
308302
}
309303

310304
fn check_struct_def(&mut self,
311-
cx: &LateContext<'a, 'tcx>,
312-
s: &'tcx hir::VariantData,
313-
_: ast::Name,
314-
_: &'tcx hir::Generics,
315-
_: ast::NodeId) {
305+
cx: &LateContext,
306+
s: &hir::VariantData,
307+
_: ast::Name,
308+
_: &hir::Generics,
309+
_: ast::NodeId) {
316310
for sf in s.fields() {
317311
self.check_snake_case(cx, "structure field", &sf.name.as_str(), Some(sf.span));
318312
}
@@ -355,7 +349,7 @@ impl LintPass for NonUpperCaseGlobals {
355349
}
356350

357351
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
358-
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item) {
352+
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
359353
match it.node {
360354
hir::ItemStatic(..) => {
361355
NonUpperCaseGlobals::check_upper_case(cx, "static variable", it.name, it.span);
@@ -367,9 +361,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
367361
}
368362
}
369363

370-
fn check_trait_item(&mut self,
371-
cx: &LateContext<'a, 'tcx>,
372-
ti: &'tcx hir::TraitItem) {
364+
fn check_trait_item(&mut self, cx: &LateContext, ti: &hir::TraitItem) {
373365
match ti.node {
374366
hir::ConstTraitItem(..) => {
375367
NonUpperCaseGlobals::check_upper_case(cx, "associated constant", ti.name, ti.span);
@@ -378,9 +370,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
378370
}
379371
}
380372

381-
fn check_impl_item(&mut self,
382-
cx: &LateContext<'a, 'tcx>,
383-
ii: &'tcx hir::ImplItem) {
373+
fn check_impl_item(&mut self, cx: &LateContext, ii: &hir::ImplItem) {
384374
match ii.node {
385375
hir::ImplItemKind::Const(..) => {
386376
NonUpperCaseGlobals::check_upper_case(cx, "associated constant", ii.name, ii.span);
@@ -389,7 +379,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
389379
}
390380
}
391381

392-
fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, p: &'tcx hir::Pat) {
382+
fn check_pat(&mut self, cx: &LateContext, p: &hir::Pat) {
393383
// Lint for constants that look like binding identifiers (#7526)
394384
if let PatKind::Path(hir::QPath::Resolved(None, ref path)) = p.node {
395385
if !path.global && path.segments.len() == 1 && path.segments[0].parameters.is_empty() {

0 commit comments

Comments
 (0)