rust-clippy/clippy_lints/src
bors d71e9c4f10 Auto merge of #4266 - uHOOCCOOHu:fix/async_fn_lifetime, r=flip1995
Ignore generated fresh lifetimes in elision check

<!--
Thank you for making Clippy better!

We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `cargo fmt`

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Delete this line and everything above before opening your PR -->

fixes #3988

changelog: Ignore generated fresh lifetimes in elision check.

**HELP**: It seems `tests/ui` are compiled under edition 2015, and I don't know how to add tests for this properly.

Here is the test input it had already passed:
```rust
#![feature(async_await)]
#![allow(dead_code)]

async fn sink1<'a>(_: &'a str) {} // lint
async fn sink1_elided(_: &str) {} // ok

async fn one_to_one<'a>(s: &'a str) -> &'a str { s } // lint
async fn one_to_one_elided(s: &str) -> &str { s } // ok
async fn all_to_one<'a>(a: &'a str, _b: &'a str) -> &'a str { a } // ok
// async fn unrelated(_: &str, _: &str) {} // Not allowed in async fn

// #3988
struct Foo;
impl Foo {
    pub async fn foo(&mut self) {} // ok
}

// rust-lang/rust#61115
async fn print(s: &str) { // ok
    println!("{}", s);
}

fn main() {}

```
2019-07-23 09:52:18 +00:00
..
methods Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
utils Fix breakage due to rust-lang/rust#62705 2019-07-21 09:36:31 +02:00
approx_const.rs Dogfood 2019-05-18 01:42:15 +02:00
arithmetic.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
assertions_on_constants.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
assign_ops.rs Fix warnings about unnecessary lifetime bounds 2019-06-20 01:36:23 +07:00
attrs.rs Typos and minor grammar corrections 2019-06-12 20:07:10 +02:00
bit_mask.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
blacklisted_name.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
block_in_if_condition.rs Fix warnings about unnecessary lifetime bounds 2019-06-20 01:36:23 +07:00
booleans.rs Fix breakage due to rust-lang/rust#61968 2019-06-21 08:14:07 +02:00
bytecount.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
cargo_common_metadata.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
checked_conversions.rs Removed symbols again. 2019-05-18 10:54:03 +02:00
cognitive_complexity.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
collapsible_if.rs Fix fallout from rust-lang/rust PR 60861. 2019-06-23 17:24:45 +02:00
consts.rs Remove needless lifetimes 2019-06-21 14:41:19 +02:00
copies.rs Fix match_same_arms false negative 2019-07-02 08:18:55 +02:00
copy_iterator.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
dbg_macro.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
default_trait_access.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
deprecated_lints.rs Various cosmetic improvements. 2019-03-10 18:06:28 +00:00
derive.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
doc.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
double_comparison.rs Format code 2019-07-18 17:23:22 +02:00
double_parens.rs Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
drop_bounds.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
drop_forget_ref.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
duration_subsec.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
else_if_without_else.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
empty_enum.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
entry.rs Fix warnings about unnecessary lifetime bounds 2019-06-20 01:36:23 +07:00
enum_clike.rs Rustup to rustc 1.36.0-nightly (2268d9923 2019-05-26) 2019-05-26 16:47:26 +02:00
enum_glob_use.rs rustup https://github.com/rust-lang/rust/pull/61836/ 2019-06-18 11:15:47 +02:00
enum_variants.rs Rustup to rustc 1.36.0-nightly (dbfe70dfc 2019-05-22) 2019-05-21 21:58:27 -07:00
eq_op.rs Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
erasing_op.rs Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
escape.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
eta_reduction.rs redundant_closure_for_method_calls fixes: 2019-06-12 13:43:36 +02:00
eval_order_dependence.rs find_by_hir_id -> find 2019-06-25 14:34:07 -07:00
excessive_precision.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
explicit_write.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
fallible_impl_from.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
format.rs Remove wrong lifetime from LintContext 2019-06-12 10:28:52 +02:00
formatting.rs Simplify unsugar_if to just an if expr check 2019-06-24 09:51:53 +02:00
functions.rs fmt 2019-06-25 14:41:10 -07:00
get_last_with_len.rs Formatting inside if_chain! macro 2019-05-21 10:45:38 +02:00
identity_conversion.rs Fix dogfood test failures. 2019-06-24 04:00:05 +02:00
identity_op.rs Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
if_not_else.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
implicit_return.rs Improved imports 2019-07-17 20:44:09 +02:00
indexing_slicing.rs Typos and minor grammar corrections 2019-06-12 20:07:10 +02:00
infallible_destructuring_match.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
infinite_iter.rs Dogfood 2019-05-18 01:42:15 +02:00
inherent_impl.rs Fix breakage due to rust-lang/rust#61968 2019-06-21 08:14:07 +02:00
inherent_to_string.rs Corrections for PR review. 2019-07-17 08:58:36 +02:00
inline_fn_without_body.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
int_plus_one.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
integer_division.rs Downgrade integer_division to restriction 2019-06-15 00:17:04 -07:00
invalid_ref.rs update tests and fix lints in clippy 2019-06-21 14:17:59 +02:00
items_after_statements.rs Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
large_enum_variant.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
len_zero.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
let_if_seq.rs Fix warnings about unnecessary lifetime bounds 2019-06-20 01:36:23 +07:00
lib.rs Fix breakage due to rust-lang/rust#60913 2019-07-21 12:52:14 +02:00
lifetimes.rs Ignore generated fresh lifetimes in elision check. 2019-07-10 01:57:25 +08:00
literal_representation.rs Add macro check for unreadable_literal lint 2019-05-15 14:57:56 +02:00
loops.rs rustfmt 2019-07-06 19:43:34 +02:00
map_clone.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
map_unit_fn.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
matches.rs Fix warnings about unnecessary lifetime bounds 2019-06-20 01:36:23 +07:00
mem_discriminant.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
mem_forget.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
mem_replace.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
minmax.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
misc.rs Lint 2019-07-15 14:00:07 -05:00
misc_early.rs Rustup to rustc 1.36.0-nightly (fe0a415b4 2019-04-23) 2019-04-23 08:25:45 -07:00
missing_const_for_fn.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
missing_doc.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
missing_inline.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
multiple_crate_versions.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
mut_mut.rs Fix warnings about unnecessary lifetime bounds 2019-06-20 01:36:23 +07:00
mut_reference.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
mutex_atomic.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
needless_bool.rs get_parent_node_by_hir_id -> get_parent_node 2019-06-25 14:33:51 -07:00
needless_borrow.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
needless_borrowed_ref.rs Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
needless_continue.rs Pacify rustfmt. 2019-06-24 04:54:23 +02:00
needless_pass_by_value.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
needless_update.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
neg_cmp_op_on_partial_ord.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
neg_multiply.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
new_without_default.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
no_effect.rs Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
non_copy_const.rs find_by_hir_id -> find 2019-06-25 14:34:07 -07:00
non_expressive_names.rs update tests and fix lints in clippy 2019-06-21 14:17:59 +02:00
ok_if_let.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
open_options.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
overflow_check_conditional.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
panic_unimplemented.rs rustup https://github.com/rust-lang/rust/pull/61995 2019-07-03 18:00:35 +02:00
partialeq_ne_impl.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
path_buf_push_overwrite.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
precedence.rs Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
ptr.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
ptr_offset_with_cast.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
question_mark.rs rustup https://github.com/rust-lang/rust/pull/61995 2019-07-03 18:00:35 +02:00
ranges.rs Make use of new outer_expn_info() function 2019-06-01 16:25:51 +07:00
redundant_clone.rs Fix breakage due to rust-lang/rust#60913 2019-07-21 12:52:14 +02:00
redundant_field_names.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
redundant_pattern_matching.rs rustup https://github.com/rust-lang/rust/pull/61995 2019-07-03 18:00:35 +02:00
redundant_static_lifetimes.rs Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES. 2019-06-14 10:45:03 +02:00
reference.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
regex.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
replace_consts.rs Remove lint for ONCE_INIT 2019-07-06 12:34:32 +07:00
returns.rs Rustup macro expansion and resolution 2019-07-12 00:26:36 +07:00
serde_api.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
shadow.rs Fix breakage due to rust-lang/rust#61988 2019-07-06 19:06:49 +02:00
slow_vector_initialization.rs Fix warnings about unnecessary lifetime bounds 2019-06-20 01:36:23 +07:00
strings.rs Extract semantic constant 2019-07-08 17:51:13 -03:00
suspicious_trait_impl.rs get_parent_node_by_hir_id -> get_parent_node 2019-06-25 14:33:51 -07:00
swap.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
temporary_assignment.rs Rustup to rustc 1.36.0-nightly (13fde05b1 2019-05-03) 2019-05-03 22:28:34 -07:00
transmute.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
transmuting_null.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
trivially_copy_pass_by_ref.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
try_err.rs Making try_err machine applicable 2019-06-24 21:28:46 -04:00
types.rs Auto merge of #4268 - mikerite:fix-4260, r=flip1995 2019-07-13 08:59:12 +00:00
unicode.rs Fix tests and make other ascii lints auto-fixable 2019-05-20 16:02:50 +02:00
unsafe_removed_from_name.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
unused_io_amount.rs Prevent symbocalypse 2019-05-17 23:53:54 +02:00
unused_label.rs Fix breakage due to rust-lang/rust#61988 2019-07-06 19:06:49 +02:00
unwrap.rs Fix warnings about unnecessary lifetime bounds 2019-06-20 01:36:23 +07:00
use_self.rs Rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-06 10:52:51 +07:00
vec.rs Make use of new outer_expn_info() function 2019-06-01 16:25:51 +07:00
wildcard_dependencies.rs Use lint pass macros 2019-04-17 09:35:22 -07:00
write.rs rustup https://github.com/rust-lang/rust/pull/61758/files 2019-06-12 10:28:58 +02:00
zero_div_zero.rs Use lint pass macros 2019-04-17 09:35:22 -07:00