From cf9370f670a360df0ea838cab5ce8750be1df7b0 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Thu, 11 May 2017 12:41:35 +0100 Subject: [PATCH] clean tests/ui/lifetimes.rs Cleaning the empty lines for clarity. --- tests/ui/lifetimes.rs | 8 ----- tests/ui/lifetimes.stderr | 66 +++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/tests/ui/lifetimes.rs b/tests/ui/lifetimes.rs index ea8a48392..e10fd590e 100644 --- a/tests/ui/lifetimes.rs +++ b/tests/ui/lifetimes.rs @@ -6,10 +6,8 @@ fn distinct_lifetimes<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: u8) { } - fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { } - fn same_lifetime_on_input<'a>(_x: &'a u8, _y: &'a u8) { } // no error, same lifetime on two params fn only_static_on_input(_x: &u8, _y: &u8, _z: &'static u8) { } // no error, static involved @@ -18,7 +16,6 @@ fn mut_and_static_input(_x: &mut u8, _y: &'static str) { } fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x } - fn multiple_in_and_out_1<'a>(x: &'a u8, _y: &'a u8) -> &'a u8 { x } // no error, multiple input refs fn multiple_in_and_out_2<'a, 'b>(x: &'a u8, _y: &'b u8) -> &'a u8 { x } // no error, multiple input refs @@ -31,18 +28,15 @@ fn deep_reference_2<'a>(x: Result<&'a u8, &'a u8>) -> &'a u8 { x.unwrap() } // n fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) } - // where clause, but without lifetimes fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> where T: Copy { Ok(x) } - type Ref<'r> = &'r u8; fn lifetime_param_1<'a>(_x: Ref<'a>, _y: &'a u8) { } // no error, same lifetime on two params fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { } - fn lifetime_param_3<'a, 'b: 'a>(_x: Ref<'a>, _y: &'b u8) { } // no error, bounded lifetime fn lifetime_param_4<'a, 'b>(_x: Ref<'a>, _y: &'b u8) where 'b: 'a { } // no error, bounded lifetime @@ -66,12 +60,10 @@ struct X { impl X { fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x } - fn self_and_in_out<'s, 't>(&'s self, _x: &'t u8) -> &'s u8 { &self.x } // no error, multiple input refs fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { } - fn self_and_same_in<'s>(&'s self, _x: &'s u8) { } // no error, same lifetimes on two params } diff --git a/tests/ui/lifetimes.stderr b/tests/ui/lifetimes.stderr index 15306dfcc..f80335af5 100644 --- a/tests/ui/lifetimes.stderr +++ b/tests/ui/lifetimes.stderr @@ -11,83 +11,83 @@ note: lint level defined here | ^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:10:1 - | -10 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $DIR/lifetimes.rs:9:1 + | +9 | fn distinct_and_static<'a, 'b>(_x: &'a u8, _y: &'b u8, _z: &'static u8) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:19:1 + --> $DIR/lifetimes.rs:17:1 | -19 | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x } +17 | fn in_and_out<'a>(x: &'a u8, _y: u8) -> &'a u8 { x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: explicit lifetimes given in parameter types where they could be elided + --> $DIR/lifetimes.rs:29:1 + | +29 | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: explicit lifetimes given in parameter types where they could be elided --> $DIR/lifetimes.rs:32:1 | -32 | fn deep_reference_3<'a>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> { Ok(x) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:36:1 - | -36 | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> where T: Copy { Ok(x) } +32 | fn where_clause_without_lt<'a, T>(x: &'a u8, _y: u8) -> Result<&'a u8, ()> where T: Copy { Ok(x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:43:1 + --> $DIR/lifetimes.rs:38:1 | -43 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { } +38 | fn lifetime_param_2<'a, 'b>(_x: Ref<'a>, _y: &'b u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:58:1 + --> $DIR/lifetimes.rs:52:1 | -58 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I> -59 | | where for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I> -60 | | { unreachable!() } +52 | / fn fn_bound_2<'a, F, I>(_m: Lt<'a, I>, _f: F) -> Lt<'a, I> +53 | | where for<'x> F: Fn(Lt<'x, I>) -> Lt<'x, I> +54 | | { unreachable!() } | |__________________^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:67:5 + --> $DIR/lifetimes.rs:61:5 | -67 | fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x } +61 | fn self_and_out<'s>(&'s self) -> &'s u8 { &self.x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:72:5 + --> $DIR/lifetimes.rs:65:5 | -72 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { } +65 | fn distinct_self_and_in<'s, 't>(&'s self, _x: &'t u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:89:1 + --> $DIR/lifetimes.rs:81:1 | -89 | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { unimplemented!() } +81 | fn struct_with_lt<'a>(_foo: Foo<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:109:1 + --> $DIR/lifetimes.rs:101:1 | -109 | fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { unimplemented!() } +101 | fn trait_obj_elided2<'a>(_arg: &'a Drop) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:113:1 + --> $DIR/lifetimes.rs:105:1 | -113 | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { unimplemented!() } +105 | fn alias_with_lt<'a>(_foo: FooAlias<'a>) -> &'a str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:124:1 + --> $DIR/lifetimes.rs:116:1 | -124 | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() } +116 | fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: explicit lifetimes given in parameter types where they could be elided - --> $DIR/lifetimes.rs:128:1 + --> $DIR/lifetimes.rs:120:1 | -128 | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { unimplemented!() } +120 | fn trait_bound_ok<'a, T: WithLifetime<'static>>(_: &'a u8, _: T) { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors