#![feature(stmt_expr_attributes)]
#![feature(range_contains)]
#![feature(macro_vis_matcher)]
-#![allow(unknown_lints, indexing_slicing, shadow_reuse, missing_docs_in_private_items)]
+#![allow(unknown_lints, shadow_reuse, missing_docs_in_private_items)]
#![recursion_limit = "256"]
#![allow(stable_features)]
#![feature(iterator_find_map)]
#![feature(macro_at_most_once_rep)]
+#![feature(rust_2018_preview)]
+#![warn(rust_2018_idioms)]
-extern crate cargo_metadata;
-#[macro_use]
-extern crate rustc;
-extern crate rustc_target;
-extern crate rustc_typeck;
-extern crate syntax;
-extern crate syntax_pos;
-
-extern crate toml;
-
-// for unicode nfc normalization
-
-extern crate unicode_normalization;
-
-// for semver check in attrs.rs
-
-extern crate semver;
+use toml;
+use rustc_plugin;
-// for regex checking
-
-extern crate regex_syntax;
-
-// for finding minimal boolean expressions
-
-extern crate quine_mc_cluskey;
-
-extern crate rustc_errors;
-extern crate rustc_plugin;
-
-#[macro_use]
-extern crate matches as matches_macro;
-
-extern crate serde;
-#[macro_use]
-extern crate serde_derive;
-
-#[macro_use]
-extern crate lazy_static;
-
-extern crate itertools;
-extern crate pulldown_cmark;
-extern crate url;
-
-#[macro_use]
-extern crate if_chain;
macro_rules! declare_clippy_lint {
{ pub $name:tt, style, $description:tt } => {
// begin lints modules, do not remove this comment, it’s used in `update_lints`
pub mod approx_const;
pub mod arithmetic;
-pub mod array_indexing;
pub mod assign_ops;
pub mod attrs;
pub mod bit_mask;
pub mod const_static_lifetime;
pub mod copies;
pub mod cyclomatic_complexity;
+pub mod default_trait_access;
pub mod derive;
pub mod doc;
pub mod double_comparison;
pub mod double_parens;
pub mod drop_forget_ref;
+pub mod duration_subsec;
pub mod else_if_without_else;
pub mod empty_enum;
pub mod entry;
pub mod identity_op;
pub mod if_let_redundant_pattern_matching;
pub mod if_not_else;
+pub mod indexing_slicing;
pub mod infallible_destructuring_match;
pub mod infinite_iter;
+pub mod inherent_impl;
pub mod inline_fn_without_body;
pub mod int_plus_one;
pub mod invalid_ref;
pub mod misc;
pub mod misc_early;
pub mod missing_doc;
+pub mod missing_inline;
pub mod multiple_crate_versions;
pub mod mut_mut;
pub mod mut_reference;
pub mod needless_continue;
pub mod needless_pass_by_value;
pub mod needless_update;
+pub mod neg_cmp_op_on_partial_ord;
pub mod neg_multiply;
pub mod new_without_default;
pub mod no_effect;
+pub mod non_copy_const;
pub mod non_expressive_names;
pub mod ok_if_let;
pub mod open_options;
pub mod swap;
pub mod temporary_assignment;
pub mod transmute;
+pub mod trivially_copy_pass_by_ref;
pub mod types;
pub mod unicode;
pub mod unsafe_removed_from_name;
pub mod unused_io_amount;
pub mod unused_label;
+pub mod unwrap;
pub mod use_self;
pub mod vec;
pub mod write;
// end lints modules, do not remove this comment, it’s used in `update_lints`
mod reexport {
- pub use syntax::ast::{Name, NodeId};
+ crate use syntax::ast::{Name, NodeId};
}
#[cfg_attr(rustfmt, rustfmt_skip)]
);
reg.register_late_lint_pass(box escape::Pass{too_large_for_stack: conf.too_large_for_stack});
reg.register_early_lint_pass(box misc_early::MiscEarly);
- reg.register_late_lint_pass(box array_indexing::ArrayIndexing);
reg.register_late_lint_pass(box panic_unimplemented::Pass);
reg.register_late_lint_pass(box strings::StringLitAsBytes);
reg.register_late_lint_pass(box derive::Derive);
reg.register_late_lint_pass(box let_if_seq::LetIfSeq);
reg.register_late_lint_pass(box eval_order_dependence::EvalOrderDependence);
reg.register_late_lint_pass(box missing_doc::MissingDoc::new());
+ reg.register_late_lint_pass(box missing_inline::MissingInline);
reg.register_late_lint_pass(box ok_if_let::Pass);
reg.register_late_lint_pass(box if_let_redundant_pattern_matching::Pass);
reg.register_late_lint_pass(box partialeq_ne_impl::Pass);
reg.register_late_lint_pass(box large_enum_variant::LargeEnumVariant::new(conf.enum_variant_size_threshold));
reg.register_late_lint_pass(box explicit_write::Pass);
reg.register_late_lint_pass(box needless_pass_by_value::NeedlessPassByValue);
+ reg.register_late_lint_pass(box trivially_copy_pass_by_ref::TriviallyCopyPassByRef::new(
+ conf.trivial_copy_size_limit,
+ ®.sess.target,
+ ));
reg.register_early_lint_pass(box literal_representation::LiteralDigitGrouping);
reg.register_early_lint_pass(box literal_representation::LiteralRepresentation::new(
conf.literal_representation_threshold
reg.register_early_lint_pass(box multiple_crate_versions::Pass);
reg.register_late_lint_pass(box map_unit_fn::Pass);
reg.register_late_lint_pass(box infallible_destructuring_match::Pass);
-
+ reg.register_late_lint_pass(box inherent_impl::Pass::default());
+ reg.register_late_lint_pass(box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
+ reg.register_late_lint_pass(box unwrap::Pass);
+ reg.register_late_lint_pass(box duration_subsec::DurationSubsec);
+ reg.register_late_lint_pass(box default_trait_access::DefaultTraitAccess);
+ reg.register_late_lint_pass(box indexing_slicing::IndexingSlicing);
+ reg.register_late_lint_pass(box non_copy_const::NonCopyConst);
reg.register_lint_group("clippy_restriction", vec![
arithmetic::FLOAT_ARITHMETIC,
arithmetic::INTEGER_ARITHMETIC,
- array_indexing::INDEXING_SLICING,
assign_ops::ASSIGN_OPS,
else_if_without_else::ELSE_IF_WITHOUT_ELSE,
+ inherent_impl::MULTIPLE_INHERENT_IMPL,
literal_representation::DECIMAL_LITERAL_REPRESENTATION,
mem_forget::MEM_FORGET,
methods::CLONE_ON_REF_PTR,
methods::WRONG_PUB_SELF_CONVENTION,
misc::FLOAT_CMP_CONST,
missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
+ missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
panic_unimplemented::UNIMPLEMENTED,
shadow::SHADOW_REUSE,
shadow::SHADOW_SAME,
reg.register_lint_group("clippy_pedantic", vec![
attrs::INLINE_ALWAYS,
copies::MATCH_SAME_ARMS,
+ default_trait_access::DEFAULT_TRAIT_ACCESS,
derive::EXPL_IMPL_CLONE_ON_COPY,
doc::DOC_MARKDOWN,
empty_enum::EMPTY_ENUM,
enum_variants::PUB_ENUM_VARIANT_NAMES,
enum_variants::STUTTER,
if_not_else::IF_NOT_ELSE,
+ indexing_slicing::INDEXING_SLICING,
infinite_iter::MAYBE_INFINITE_ITER,
items_after_statements::ITEMS_AFTER_STATEMENTS,
matches::SINGLE_MATCH_ELSE,
reg.register_lint_group("clippy", vec![
approx_const::APPROX_CONSTANT,
- array_indexing::OUT_OF_BOUNDS_INDEXING,
assign_ops::ASSIGN_OP_PATTERN,
assign_ops::MISREFACTORED_ASSIGN_OP,
attrs::DEPRECATED_SEMVER,
drop_forget_ref::DROP_REF,
drop_forget_ref::FORGET_COPY,
drop_forget_ref::FORGET_REF,
+ duration_subsec::DURATION_SUBSEC,
entry::MAP_ENTRY,
enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
enum_variants::ENUM_VARIANT_NAMES,
identity_conversion::IDENTITY_CONVERSION,
identity_op::IDENTITY_OP,
if_let_redundant_pattern_matching::IF_LET_REDUNDANT_PATTERN_MATCHING,
+ indexing_slicing::OUT_OF_BOUNDS_INDEXING,
infallible_destructuring_match::INFALLIBLE_DESTRUCTURING_MATCH,
infinite_iter::INFINITE_ITER,
inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
methods::CHARS_NEXT_CMP,
methods::CLONE_DOUBLE_REF,
methods::CLONE_ON_COPY,
+ methods::EXPECT_FUN_CALL,
methods::FILTER_NEXT,
methods::GET_UNWRAP,
methods::ITER_CLONED_COLLECT,
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
needless_update::NEEDLESS_UPDATE,
+ neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
neg_multiply::NEG_MULTIPLY,
new_without_default::NEW_WITHOUT_DEFAULT,
new_without_default::NEW_WITHOUT_DEFAULT_DERIVE,
no_effect::NO_EFFECT,
no_effect::UNNECESSARY_OPERATION,
+ non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
+ non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
non_expressive_names::MANY_SINGLE_CHAR_NAMES,
ok_if_let::IF_LET_SOME_RESULT,
transmute::TRANSMUTE_PTR_TO_REF,
transmute::USELESS_TRANSMUTE,
transmute::WRONG_TRANSMUTE,
+ trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
types::ABSURD_EXTREME_COMPARISONS,
types::BORROWED_BOX,
types::BOX_VEC,
types::CAST_LOSSLESS,
types::CAST_PTR_ALIGNMENT,
types::CHAR_LIT_AS_U8,
+ types::FN_TO_NUMERIC_CAST,
+ types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
types::IMPLICIT_HASHER,
types::LET_UNIT_VALUE,
types::OPTION_OPTION,
returns::LET_AND_RETURN,
returns::NEEDLESS_RETURN,
strings::STRING_LIT_AS_BYTES,
+ types::FN_TO_NUMERIC_CAST,
types::IMPLICIT_HASHER,
types::LET_UNIT_VALUE,
unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
cyclomatic_complexity::CYCLOMATIC_COMPLEXITY,
double_comparison::DOUBLE_COMPARISONS,
double_parens::DOUBLE_PARENS,
+ duration_subsec::DURATION_SUBSEC,
eval_order_dependence::DIVERGING_SUB_EXPRESSION,
eval_order_dependence::EVAL_ORDER_DEPENDENCE,
explicit_write::EXPLICIT_WRITE,
needless_bool::NEEDLESS_BOOL,
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
needless_update::NEEDLESS_UPDATE,
+ neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
no_effect::NO_EFFECT,
no_effect::UNNECESSARY_OPERATION,
overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
reg.register_lint_group("clippy_correctness", vec![
approx_const::APPROX_CONSTANT,
- array_indexing::OUT_OF_BOUNDS_INDEXING,
attrs::DEPRECATED_SEMVER,
attrs::USELESS_ATTRIBUTE,
bit_mask::BAD_BIT_MASK,
erasing_op::ERASING_OP,
formatting::POSSIBLE_MISSING_COMMA,
functions::NOT_UNSAFE_PTR_ARG_DEREF,
+ indexing_slicing::OUT_OF_BOUNDS_INDEXING,
infinite_iter::INFINITE_ITER,
inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
invalid_ref::INVALID_REF,
misc::CMP_NAN,
misc::FLOAT_CMP,
misc::MODULO_ONE,
+ non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
+ non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
open_options::NONSENSICAL_OPEN_OPTIONS,
ptr::MUT_FROM_REF,
ranges::ITERATOR_STEP_BY_ZERO,
transmute::WRONG_TRANSMUTE,
types::ABSURD_EXTREME_COMPARISONS,
types::CAST_PTR_ALIGNMENT,
+ types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
types::UNIT_CMP,
unicode::ZERO_WIDTH_SPACE,
unused_io_amount::UNUSED_IO_AMOUNT,
large_enum_variant::LARGE_ENUM_VARIANT,
loops::MANUAL_MEMCPY,
loops::UNUSED_COLLECT,
+ methods::EXPECT_FUN_CALL,
methods::ITER_NTH,
methods::OR_FUN_CALL,
methods::SINGLE_CHAR_PATTERN,
misc::CMP_OWNED,
mutex_atomic::MUTEX_ATOMIC,
+ trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
types::BOX_VEC,
vec::USELESS_VEC,
]);
mutex_atomic::MUTEX_INTEGER,
needless_borrow::NEEDLESS_BORROW,
ranges::RANGE_PLUS_ONE,
+ unwrap::PANICKING_UNWRAP,
+ unwrap::UNNECESSARY_UNWRAP,
]);
}