Skip to content

Commit dd91c8f

Browse files
oli-obkestebank
andcommittedOct 22, 2018
[review comments] modify test and clean up code
Co-Authored-By: estebank <[email protected]>
1 parent d0bd69a commit dd91c8f

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed
 

‎src/librustc/middle/resolve_lifetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
22522252
fn suggest_lifetime(&self, db: &mut DiagnosticBuilder<'_>, span: Span, msg: &str) -> bool {
22532253
match self.tcx.sess.source_map().span_to_snippet(span) {
22542254
Ok(ref snippet) => {
2255-
let (sugg, applicability) = if &snippet[..] == "&" {
2255+
let (sugg, applicability) = if snippet == "&" {
22562256
("&'static ".to_owned(), Applicability::MachineApplicable)
22572257
} else if snippet == "'_" {
22582258
("'static".to_owned(), Applicability::MachineApplicable)

‎src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ use std::error::Error;
88
fn foo() -> impl Future<Item=(), Error=Box<Error>> {
99
Ok(())
1010
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
error[E0601]: `main` function not found in crate `lifetime_elision_return_type_trait`
2-
|
3-
= note: consider adding a `main` function to `$DIR/lifetime-elision-return-type-trait.rs`
4-
51
error[E0106]: missing lifetime specifier
62
--> $DIR/lifetime-elision-return-type-trait.rs:8:44
73
|
@@ -10,7 +6,6 @@ LL | fn foo() -> impl Future<Item=(), Error=Box<Error>> {
106
|
117
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
128

13-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1410

15-
Some errors occurred: E0106, E0601.
16-
For more information about an error, try `rustc --explain E0106`.
11+
For more information about this error, try `rustc --explain E0106`.

0 commit comments

Comments
 (0)
Please sign in to comment.