rust-clippy/clippy_lints/src
bors ea079eb8a4 Auto merge of #6081 - ilknarf:master, r=matthiaskrgr
New Lint: disallowed_method

Fixes https://github.com/rust-lang/rust-clippy/issues/6073

I added a `disallowed_method` lint that works similar to `blacklisted_name`, e.g allows config-defined disallowed method calls.

This lint allows advanced users to patch in undesired method calls for specific projects. It basically uses the DefId of method calls and matches it to parsed strings. Is there an alternative approach that could use more easily digestible configuration strings?

All tests pass as expected except for a linting error on `ui/redundant_pattern_matching_option`, which I am not sure how to resolve since I don't think I changed anything affecting it.

changelog: Add disallowed_method lint to warn on user-defined method calls
2020-09-26 20:55:53 +00:00
..
methods replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
utils remove useless test, update disallowed_method description 2020-09-25 11:09:04 -05:00
approx_const.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
arithmetic.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
as_conversions.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
assertions_on_constants.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
assign_ops.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
async_yields_async.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
atomic_ordering.rs Add comments to the invalid_atomic_ordering example 2020-09-10 14:50:10 -07:00
attrs.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
await_holding_lock.rs Fix typo 2020-09-10 22:41:08 +09:00
bit_mask.rs Downgrade verbose_bit_mask to pedantic 2020-09-13 23:23:45 +09:00
blacklisted_name.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
blocks_in_if_conditions.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
booleans.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
bytecount.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
cargo_common_metadata.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
checked_conversions.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
cognitive_complexity.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
collapsible_if.rs Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup 2020-07-14 14:59:59 +02:00
comparison_chain.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
consts.rs Satisfy rc_buffer lint in Constant::Binary byte string by copying data 2020-09-22 20:35:54 -06:00
copies.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
copy_iterator.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
create_dir.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
dbg_macro.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
default_trait_access.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
deprecated_lints.rs Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup 2020-07-26 21:07:07 +02:00
dereference.rs Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup 2020-07-26 21:07:07 +02:00
derive.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
disallowed_method.rs remove useless test, update disallowed_method description 2020-09-25 11:09:04 -05:00
doc.rs Fix manual-strip dogfood errors 2020-09-14 06:11:35 +02:00
double_comparison.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
double_parens.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
drop_bounds.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
drop_forget_ref.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
duration_subsec.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
else_if_without_else.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
empty_enum.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
entry.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
enum_clike.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
enum_variants.rs Fully integrate token collection for additional AST structs 2020-09-10 17:58:14 -04:00
eq_op.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
erasing_op.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
escape.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
eta_reduction.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
eval_order_dependence.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
excessive_bools.rs Add an Option<Span> argument to span_lint_and_help. 2020-04-18 18:28:29 +08:00
exit.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
explicit_write.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
fallible_impl_from.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
float_equality_without_abs.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
float_literal.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
floating_point_arithmetic.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
format.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
formatting.rs Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup 2020-07-14 14:59:59 +02:00
functions.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
future_not_send.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
get_last_with_len.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
identity_op.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
if_let_mutex.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
if_let_some_result.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
if_not_else.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
implicit_return.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
implicit_saturating_sub.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
indexing_slicing.rs fix a FP in indexing_slicing 2020-09-17 10:11:10 +12:00
infinite_iter.rs clippy: support QPath::LangItem 2020-08-17 13:55:05 +01:00
inherent_impl.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
inherent_to_string.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
inline_fn_without_body.rs rustc_ast: (Nested)MetaItem::check_name -> has_name 2020-08-04 00:34:11 +03:00
int_plus_one.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
integer_division.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
items_after_statements.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
large_const_arrays.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
large_enum_variant.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
large_stack_arrays.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
len_zero.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
let_if_seq.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
let_underscore.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
lib.rs change config variables to reference, remove wildcard import 2020-09-25 11:09:04 -05:00
lifetimes.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
literal_representation.rs Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup 2020-07-14 14:59:59 +02:00
loops.rs Fix a FP in explicit_counter_loop 2020-09-23 08:15:44 +12:00
macro_use.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
main_recursion.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
manual_async_fn.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
manual_non_exhaustive.rs Fully integrate token collection for additional AST structs 2020-09-10 17:58:14 -04:00
manual_strip.rs manual-strip: Fix formatting 2020-09-15 21:32:27 +02:00
map_clone.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
map_err_ignore.rs Move map_err_ignore from style to pedantic 2020-09-08 19:37:14 -04:00
map_identity.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
map_unit_fn.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
match_on_vec_items.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
matches.rs Forbid redundant_pattern_matching triggering in macros 2020-09-21 20:49:42 +03:00
mem_discriminant.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
mem_forget.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
mem_replace.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
minmax.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
misc.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
misc_early.rs Fix manual-strip dogfood errors 2020-09-14 06:11:35 +02:00
missing_const_for_fn.rs Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup 2020-07-26 21:07:07 +02:00
missing_doc.rs rustc_ast: (Nested)MetaItem::check_name -> has_name 2020-08-04 00:34:11 +03:00
missing_inline.rs rustc_ast: (Nested)MetaItem::check_name -> has_name 2020-08-04 00:34:11 +03:00
modulo_arithmetic.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
multiple_crate_versions.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
mut_key.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
mut_mut.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
mut_reference.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
mutable_debug_assertion.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
mutex_atomic.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
needless_arbitrary_self_type.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
needless_bool.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
needless_borrow.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
needless_borrowed_ref.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
needless_continue.rs Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
needless_pass_by_value.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
needless_update.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
neg_cmp_op_on_partial_ord.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
neg_multiply.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
new_without_default.rs merge as_local_hir_id with local_def_id_to_hir_id 2020-08-13 16:55:16 +02:00
no_effect.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
non_copy_const.rs rewrite the test and fix a minor fp 2020-09-17 19:48:40 +12:00
non_expressive_names.rs Eliminate the SessionGlobals from librustc_ast. 2020-08-08 12:03:42 +10:00
open_options.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
option_env_unwrap.rs Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
option_if_let_else.rs Auto merge of #5937 - montrivo:option_if_let_else, r=flip1995 2020-09-16 19:36:49 +00:00
overflow_check_conditional.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
panic_in_result_fn.rs removing if chain and renaming lint 2020-09-09 14:02:34 -07:00
panic_unimplemented.rs Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup 2020-07-26 21:07:07 +02:00
partialeq_ne_impl.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
path_buf_push_overwrite.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
pattern_type_mismatch.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
precedence.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
ptr.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
ptr_offset_with_cast.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
question_mark.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
ranges.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
redundant_clone.rs Fix manual-strip dogfood errors 2020-09-14 06:11:35 +02:00
redundant_closure_call.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
redundant_field_names.rs Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
redundant_pub_crate.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
redundant_static_lifetimes.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
reference.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
regex.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
repeat_once.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
returns.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
self_assignment.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
serde_api.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
shadow.rs Add note to shadow_unrelated 2020-09-16 01:01:31 +09:00
single_component_path_imports.rs Fully integrate token collection for additional AST structs 2020-09-10 17:58:14 -04:00
slow_vector_initialization.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
stable_sort_primitive.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
strings.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
suspicious_trait_impl.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
swap.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
tabs_in_doc_comments.rs Add some comments for magic numbers + Add tests 2020-08-06 22:55:26 +03:00
temporary_assignment.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
to_digit_is_some.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
to_string_in_display.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
trait_bounds.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
transmute.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
transmuting_null.rs rust_ast::ast => rustc_ast 2020-08-17 20:32:32 +00:00
trivially_copy_pass_by_ref.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
try_err.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
types.rs Move rc_buffer lint into perf category 2020-09-16 17:20:36 -06:00
unicode.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
unit_return_expecting_ord.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
unnamed_address.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
unnecessary_sort_by.rs Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup 2020-09-10 17:47:07 +02:00
unnested_or_patterns.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
unsafe_removed_from_name.rs Avoid storing SymbolStr in a struct. 2020-07-17 08:28:22 +10:00
unused_io_amount.rs clippy: support QPath::LangItem 2020-08-17 13:55:05 +01:00
unused_self.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
unused_unit.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
unwrap.rs Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
unwrap_in_result.rs replace walk_ptrs_ty with peel_refs 2020-09-17 10:11:59 +12:00
use_self.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
useless_conversion.rs useless_conversion: show type in error message. 2020-09-13 12:50:39 +02:00
vec.rs ty.kind -> ty.kind() in rustdoc and clippy 2020-09-04 18:27:33 +02:00
vec_resize_to_zero.rs rust_ast::ast => rustc_ast 2020-08-17 20:32:32 +00:00
verbose_file_reads.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
wildcard_dependencies.rs Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
wildcard_imports.rs Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
write.rs Some small fixes 2020-09-26 23:10:25 +09:00
zero_div_zero.rs Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00