Address review comments, move to travis

This commit is contained in:
Manish Goregaokar 2015-08-13 21:10:45 +05:30
parent 485960a00c
commit 3cf5c36296
4 changed files with 15 additions and 25 deletions

View File

@ -5,3 +5,4 @@ sudo: false
script:
- python util/update_lints.py -c
- cargo test
- bash util/dogfood.sh

View File

@ -170,15 +170,15 @@ impl RefVisitor {
impl<'v> Visitor<'v> for RefVisitor {
// for lifetimes of references
fn visit_opt_lifetime_ref(&mut self, _: Span, lifetime: &Option<Lifetime>) {
fn visit_opt_lifetime_ref(&mut self, _: Span, lifetime: &'v Option<Lifetime>) {
self.record(lifetime);
}
// for lifetimes as parameters of generics
fn visit_lifetime_ref(&mut self, lifetime: &Lifetime) {
fn visit_lifetime_ref(&mut self, lifetime: &'v Lifetime) {
self.record(&Some(*lifetime));
}
// for lifetime bounds; the default impl calls visit_lifetime_ref
fn visit_lifetime_bound(&mut self, _: &Lifetime) { }
fn visit_lifetime_bound(&mut self, _: &'v Lifetime) { }
}

View File

@ -2,7 +2,7 @@
#![plugin(clippy)]
#![deny(needless_lifetimes)]
#![allow(dead_code)]
fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { }
//~^ERROR explicit lifetimes given
@ -54,27 +54,13 @@ impl X {
fn self_and_same_in<'s>(&'s self, _x: &'s u8) { } // no error, same lifetimes on two params
}
struct Foo<'a>(&'a u8);
impl<'a> Foo<'a> {
fn self_shared_lifetime(&self, _: &'a u8) {} // no error, lifetime 'a not defined in method
fn self_bound_lifetime<'b: 'a>(&self, _: &'b u8) {} // no error, bounds exist
}
static STATIC: u8 = 1;
fn main() {
distinct_lifetimes(&1, &2, 3);
distinct_and_static(&1, &2, &STATIC);
same_lifetime_on_input(&1, &2);
only_static_on_input(&1, &2, &STATIC);
in_and_out(&1, 2);
multiple_in_and_out_1(&1, &2);
multiple_in_and_out_2(&1, &2);
in_static_and_out(&1, &STATIC);
let _ = deep_reference_1(&1, &2);
let _ = deep_reference_2(Ok(&1));
let _ = deep_reference_3(&1, 2);
lifetime_param_1(&1, &2);
lifetime_param_2(&1, &2);
lifetime_param_3(&1, &2);
let foo = X { x: 1 };
foo.self_and_out();
foo.self_and_in_out(&1);
foo.distinct_self_and_in(&1);
foo.self_and_same_in(&1);
}

View File

@ -1 +1,4 @@
rm -rf target* && cargo build --lib && cp -R target target_recur && cargo rustc -- -Zextra-plugins=clippy -Ltarget_recur/debug -Dclippy
rm -rf target*/*so
cargo build --lib && cp -R target target_recur && cargo rustc -- -Zextra-plugins=clippy -Ltarget_recur/debug -Dclippy || exit 1
rm -rf target_recur