diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-05-14 10:06:21 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-05-14 10:33:48 +0200 |
| commit | dfbc74b08bcbe6ecb8589423186a74c5a0103448 (patch) | |
| tree | 048c0569a530191832941169f8b6775e1014732b | |
| parent | af80c53450d723824bc532c65687da8dd68ece80 (diff) | |
| download | rust-dfbc74b08bcbe6ecb8589423186a74c5a0103448.tar.gz rust-dfbc74b08bcbe6ecb8589423186a74c5a0103448.zip | |
Rustfmt all the things
57 files changed, 241 insertions, 208 deletions
diff --git a/clippy_lints/src/approx_const.rs b/clippy_lints/src/approx_const.rs index 2f6ddce5108..c8317290912 100644 --- a/clippy_lints/src/approx_const.rs +++ b/clippy_lints/src/approx_const.rs @@ -1,5 +1,6 @@ use crate::utils::span_lint; use crate::utils::sym; +use lazy_static::lazy_static; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; @@ -7,7 +8,6 @@ use std::f64::consts as f64; use syntax::ast::{FloatTy, LitKind}; use syntax::symbol; use syntax::symbol::Symbol; -use lazy_static::lazy_static; declare_clippy_lint! { /// **What it does:** Checks for floating point literals that approximate diff --git a/clippy_lints/src/assertions_on_constants.rs b/clippy_lints/src/assertions_on_constants.rs index b3d35f863e2..1690c10e291 100644 --- a/clippy_lints/src/assertions_on_constants.rs +++ b/clippy_lints/src/assertions_on_constants.rs @@ -5,8 +5,8 @@ use rustc::{declare_lint_pass, declare_tool_lint}; use syntax_pos::Span; use crate::consts::{constant, Constant}; -use crate::utils::{in_macro_or_desugar, is_direct_expn_of, span_help_and_lint}; use crate::utils::sym; +use crate::utils::{in_macro_or_desugar, is_direct_expn_of, span_help_and_lint}; declare_clippy_lint! { /// **What it does:** Checks for `assert!(true)` and `assert!(false)` calls. diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 9bec6416dbf..754dc3a06ae 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -1,11 +1,11 @@ //! checks for attributes use crate::reexport::*; +use crate::utils::sym; use crate::utils::{ - in_macro_or_desugar, is_present_in_source, last_line_of_span, paths, snippet_opt, span_lint, span_lint_and_sugg, - span_lint_and_then, without_block_comments, match_def_path + in_macro_or_desugar, is_present_in_source, last_line_of_span, match_def_path, paths, snippet_opt, span_lint, + span_lint_and_sugg, span_lint_and_then, without_block_comments, }; -use crate::utils::sym; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{ @@ -245,7 +245,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Attributes { for lint in lint_list { match item.node { ItemKind::Use(..) => { - if is_word(lint, *sym::unused_imports) || is_word(lint, *sym::deprecated) { + if is_word(lint, *sym::unused_imports) + || is_word(lint, *sym::deprecated) + { return; } }, diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index b939aec4df2..f58b17e9a29 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -1,8 +1,9 @@ +use crate::utils::sym; use crate::utils::{ get_trait_def_id, implements_trait, in_macro, in_macro_or_desugar, match_type, paths, snippet_opt, span_lint_and_then, SpanlessEq, }; -use crate::utils::sym; +use lazy_static::lazy_static; use rustc::hir::intravisit::*; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; @@ -12,7 +13,6 @@ use rustc_errors::Applicability; use syntax::ast::LitKind; use syntax::source_map::{dummy_spanned, Span, DUMMY_SP}; use syntax::symbol::Symbol; -use lazy_static::lazy_static; declare_clippy_lint! { /// **What it does:** Checks for boolean expressions that can be written more diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index 131aa988f30..e9b0ae6797c 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -1,8 +1,8 @@ +use crate::utils::sym; use crate::utils::{ contains_name, get_pat_name, match_type, paths, single_segment_path, snippet_with_applicability, span_lint_and_sugg, walk_ptrs_ty, }; -use crate::utils::sym; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/dbg_macro.rs b/clippy_lints/src/dbg_macro.rs index 0ad8c401bf3..637e19bd60e 100644 --- a/clippy_lints/src/dbg_macro.rs +++ b/clippy_lints/src/dbg_macro.rs @@ -1,5 +1,5 @@ -use crate::utils::{snippet_opt, span_help_and_lint, span_lint_and_sugg}; use crate::utils::sym; +use crate::utils::{snippet_opt, span_help_and_lint, span_lint_and_sugg}; use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; use rustc_errors::Applicability; diff --git a/clippy_lints/src/default_trait_access.rs b/clippy_lints/src/default_trait_access.rs index 606058808de..ba1312add74 100644 --- a/clippy_lints/src/default_trait_access.rs +++ b/clippy_lints/src/default_trait_access.rs @@ -5,7 +5,7 @@ use rustc::ty; use rustc::{declare_lint_pass, declare_tool_lint}; use rustc_errors::Applicability; -use crate::utils::{any_parent_is_automatically_derived, paths, span_lint_and_sugg, match_def_path}; +use crate::utils::{any_parent_is_automatically_derived, match_def_path, paths, span_lint_and_sugg}; declare_clippy_lint! { /// **What it does:** Checks for literal calls to `Default::default()`. diff --git a/clippy_lints/src/drop_bounds.rs b/clippy_lints/src/drop_bounds.rs index 30188ecb70e..61009cc6339 100644 --- a/clippy_lints/src/drop_bounds.rs +++ b/clippy_lints/src/drop_bounds.rs @@ -1,4 +1,4 @@ -use crate::utils::{paths, span_lint, match_def_path}; +use crate::utils::{match_def_path, paths, span_lint}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/drop_forget_ref.rs b/clippy_lints/src/drop_forget_ref.rs index 5e1a6ff15cb..a6dcb51fcae 100644 --- a/clippy_lints/src/drop_forget_ref.rs +++ b/clippy_lints/src/drop_forget_ref.rs @@ -1,4 +1,4 @@ -use crate::utils::{is_copy, paths, span_note_and_lint, match_def_path}; +use crate::utils::{is_copy, match_def_path, paths, span_note_and_lint}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 41b41ab7b75..66ae2966dfb 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -1,5 +1,5 @@ -use crate::utils::SpanlessEq; use crate::utils::sym; +use crate::utils::SpanlessEq; use crate::utils::{get_item_name, higher, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty}; use if_chain::if_chain; use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; diff --git a/clippy_lints/src/explicit_write.rs b/clippy_lints/src/explicit_write.rs index 3790b8ef337..11f2770333f 100644 --- a/clippy_lints/src/explicit_write.rs +++ b/clippy_lints/src/explicit_write.rs @@ -1,5 +1,5 @@ -use crate::utils::{is_expn_of, resolve_node, span_lint, span_lint_and_sugg, match_def_path}; use crate::utils::sym; +use crate::utils::{is_expn_of, match_def_path, paths, resolve_node, span_lint, span_lint_and_sugg}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; @@ -42,11 +42,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitWrite { if write_args.len() > 0; if let ExprKind::Call(ref dest_fun, _) = write_args[0].node; if let ExprKind::Path(ref qpath) = dest_fun.node; - if let Some(dest_fun_id) = - resolve_node(cx, qpath, dest_fun.hir_id).opt_def_id(); - if let Some(dest_name) = if match_def_path(cx, dest_fun_id, &[*sym::std, *sym::io, *sym::stdio, *sym::stdout]) { + if let Some(dest_fun_id) = resolve_node(cx, qpath, dest_fun.hir_id).opt_def_id(); + if let Some(dest_name) = if match_def_path(cx, dest_fun_id, &*paths::STDOUT) { Some("stdout") - } else if match_def_path(cx, dest_fun_id, &[*sym::std, *sym::io, *sym::stdio, *sym::stderr]) { + } else if match_def_path(cx, dest_fun_id, &*paths::STDERR) { Some("stderr") } else { None diff --git a/clippy_lints/src/fallible_impl_from.rs b/clippy_lints/src/fallible_impl_from.rs index c1b4db602cb..ee1b888cb07 100644 --- a/clippy_lints/src/fallible_impl_from.rs +++ b/clippy_lints/src/fallible_impl_from.rs @@ -1,13 +1,13 @@ use crate::utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT}; -use crate::utils::{is_expn_of, method_chain_args, span_lint_and_then, walk_ptrs_ty, match_def_path}; use crate::utils::sym; +use crate::utils::{is_expn_of, match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty}; use if_chain::if_chain; use rustc::hir; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::ty::{self, Ty}; use rustc::{declare_lint_pass, declare_tool_lint}; -use syntax_pos::Span; use syntax::symbol::Symbol; +use syntax_pos::Span; declare_clippy_lint! { /// **What it does:** Checks for impls of `From<..>` that contain `panic!()` or `unwrap()` diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index 2064ccd3d63..cb9e486a709 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -1,8 +1,8 @@ use crate::utils::paths; use crate::utils::sym; use crate::utils::{ - in_macro_or_desugar, is_expn_of, last_path_segment, match_type, resolve_node, snippet, span_lint_and_then, - walk_ptrs_ty, match_def_path, + in_macro_or_desugar, is_expn_of, last_path_segment, match_def_path, match_type, resolve_node, snippet, + span_lint_and_then, walk_ptrs_ty, }; use if_chain::if_chain; use rustc::hir::*; diff --git a/clippy_lints/src/identity_conversion.rs b/clippy_lints/src/identity_conversion.rs index 85bf7611a8f..5d15eb3341b 100644 --- a/clippy_lints/src/identity_conversion.rs +++ b/clippy_lints/src/identity_conversion.rs @@ -1,6 +1,6 @@ use crate::utils::{ - in_macro_or_desugar, match_trait_method, same_tys, snippet, snippet_with_macro_callsite, span_lint_and_then, - match_def_path, + in_macro_or_desugar, match_def_path, match_trait_method, same_tys, snippet, snippet_with_macro_callsite, + span_lint_and_then, }; use crate::utils::{paths, resolve_node}; use rustc::hir::*; diff --git a/clippy_lints/src/implicit_return.rs b/clippy_lints/src/implicit_return.rs index 4005a5ded62..368aeb4424f 100644 --- a/clippy_lints/src/implicit_return.rs +++ b/clippy_lints/src/implicit_return.rs @@ -1,5 +1,5 @@ -use crate::utils::{in_macro_or_desugar, is_expn_of, snippet_opt, span_lint_and_then}; use crate::utils::sym; +use crate::utils::{in_macro_or_desugar, is_expn_of, snippet_opt, span_lint_and_then}; use rustc::hir::{intravisit::FnKind, Body, ExprKind, FnDecl, HirId, MatchSource}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/infinite_iter.rs b/clippy_lints/src/infinite_iter.rs index 717edd63806..6d5c1375bc4 100644 --- a/clippy_lints/src/infinite_iter.rs +++ b/clippy_lints/src/infinite_iter.rs @@ -2,10 +2,10 @@ use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; -use crate::utils::{get_trait_def_id, higher, implements_trait, match_qpath, match_type, paths, span_lint}; use crate::utils::sym; -use syntax::symbol::Symbol; +use crate::utils::{get_trait_def_id, higher, implements_trait, match_qpath, match_type, paths, span_lint}; use lazy_static::lazy_static; +use syntax::symbol::Symbol; declare_clippy_lint! { /// **What it does:** Checks for iteration that is guaranteed to be infinite. diff --git a/clippy_lints/src/invalid_ref.rs b/clippy_lints/src/invalid_ref.rs index de3e805a548..9641e9f9e4b 100644 --- a/clippy_lints/src/invalid_ref.rs +++ b/clippy_lints/src/invalid_ref.rs @@ -1,4 +1,4 @@ -use crate::utils::{paths, span_help_and_lint, match_def_path}; +use crate::utils::{match_def_path, paths, span_help_and_lint}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index 9711ec7fb61..131f0301c42 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -1,7 +1,7 @@ +use crate::utils::sym; use crate::utils::{ get_item_name, in_macro_or_desugar, snippet_with_applicability, span_lint, span_lint_and_sugg, walk_ptrs_ty, }; -use crate::utils::sym; use rustc::hir::def_id::DefId; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; @@ -141,7 +141,8 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items } } - if cx.access_levels.is_exported(visited_trait.hir_id) && trait_items.iter().any(|i| is_named_self(cx, i, *sym::len)) { + if cx.access_levels.is_exported(visited_trait.hir_id) && trait_items.iter().any(|i| is_named_self(cx, i, *sym::len)) + { let mut current_and_super_traits = FxHashSet::default(); let visited_trait_def_id = cx.tcx.hir().local_def_id_from_hir_id(visited_trait.hir_id); fill_trait_set(visited_trait_def_id, &mut current_and_super_traits, cx); diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index ec0cce613f5..ff75fbaa55f 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -476,7 +476,9 @@ struct BodyLifetimeChecker { impl<'tcx> Visitor<'tcx> for BodyLifetimeChecker { // for lifetimes as parameters of generics fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) { - if lifetime.name.ident().name != keywords::Invalid.name() && lifetime.name.ident().name != syntax::symbol::keywords::StaticLifetime.name() { + if lifetime.name.ident().name != keywords::Invalid.name() + && lifetime.name.ident().name != syntax::symbol::keywords::StaticLifetime.name() + { self.lifetimes_used_in_body = true; } } diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 86f7ea8d581..9280461548c 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -10,9 +10,9 @@ use rustc::middle::region; use rustc::{declare_lint_pass, declare_tool_lint}; // use rustc::middle::region::CodeExtent; use crate::consts::{constant, Constant}; +use crate::utils::sym; use crate::utils::usage::mutated_variables; use crate::utils::{in_macro_or_desugar, sext, sugg}; -use crate::utils::sym; use rustc::middle::expr_use_visitor::*; use rustc::middle::mem_categorization::cmt_; use rustc::middle::mem_categorization::Categorization; @@ -594,7 +594,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Loops { fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) { if let StmtKind::Semi(ref expr) = stmt.node { if let ExprKind::MethodCall(ref method, _, ref args) = expr.node { - if args.len() == 1 && method.ident.name == *sym::collect && match_trait_method(cx, expr, &*paths::ITERATOR) { + if args.len() == 1 + && method.ident.name == *sym::collect + && match_trait_method(cx, expr, &*paths::ITERATOR) + { span_lint( cx, UNUSED_COLLECT, diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 2e42e3f6dd9..fb290ee3ac8 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -1,7 +1,7 @@ use crate::consts::{constant, Constant}; use crate::utils::paths; -use crate::utils::sym; use crate::utils::sugg::Sugg; +use crate::utils::sym; use crate::utils::{ expr_block, in_macro_or_desugar, is_allowed, is_expn_of, match_qpath, match_type, multispan_sugg, remove_blocks, snippet, snippet_with_applicability, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty, diff --git a/clippy_lints/src/mem_discriminant.rs b/clippy_lints/src/mem_discriminant.rs index a9f1b018bf7..2ce56647ac7 100644 --- a/clippy_lints/src/mem_discriminant.rs +++ b/clippy_lints/src/mem_discriminant.rs @@ -1,4 +1,4 @@ -use crate::utils::{paths, snippet, span_lint_and_then, walk_ptrs_ty_depth, match_def_path}; +use crate::utils::{match_def_path, paths, snippet, span_lint_and_then, walk_ptrs_ty_depth}; use if_chain::if_chain; use rustc::hir::{Expr, ExprKind}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/mem_forget.rs b/clippy_lints/src/mem_forget.rs index 4e699f3bde5..3f314d33282 100644 --- a/clippy_lints/src/mem_forget.rs +++ b/clippy_lints/src/mem_forget.rs @@ -1,4 +1,4 @@ -use crate::utils::{paths, span_lint, match_def_path}; +use crate::utils::{match_def_path, paths, span_lint}; use rustc::hir::{Expr, ExprKind}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/mem_replace.rs b/clippy_lints/src/mem_replace.rs index 3f43b8e42e4..2649fd6a519 100644 --- a/clippy_lints/src/mem_replace.rs +++ b/clippy_lints/src/mem_replace.rs @@ -1,4 +1,4 @@ -use crate::utils::{match_qpath, paths, snippet_with_applicability, span_lint_and_sugg, match_def_path}; +use crate::utils::{match_def_path, match_qpath, paths, snippet_with_applicability, span_lint_and_sugg}; use if_chain::if_chain; use rustc::hir::{Expr, ExprKind, MutMutable, QPath}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index ac903669b7d..3e093cf3109 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -6,6 +6,7 @@ use std::fmt; use std::iter; use if_chain::if_chain; +use lazy_static::lazy_static; use matches::matches; use rustc::hir; use rustc::hir::def::{DefKind, Res}; @@ -16,18 +17,16 @@ use rustc_errors::Applicability; use syntax::ast; use syntax::source_map::{BytePos, Span}; use syntax::symbol::{LocalInternedString, Symbol}; -use lazy_static::lazy_static; use crate::utils::paths; use crate::utils::sugg; use crate::utils::sym; use crate::utils::{ get_arg_name, get_parent_expr, get_trait_def_id, has_iter_method, implements_trait, in_macro, is_copy, - is_ctor_function, is_expn_of, is_self, is_self_ty, iter_input_pats, last_path_segment, match_path, match_qpath, - match_trait_method, match_type, match_var, method_calls, method_chain_args, remove_blocks, return_ty, same_tys, - single_segment_path, snippet, snippet_with_applicability, snippet_with_macro_callsite, span_lint, + is_ctor_function, is_expn_of, is_self, is_self_ty, iter_input_pats, last_path_segment, match_def_path, match_path, + match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, remove_blocks, return_ty, + same_tys, single_segment_path, snippet, snippet_with_applicability, snippet_with_macro_callsite, span_lint, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq, - match_def_path, }; declare_clippy_lint! { @@ -1068,7 +1067,8 @@ fn lint_or_fun_call(cx: &LateContext<'_, '_>, expr: &hir::Expr, method_span: Spa if ["default", "new"].contains(&path) { let arg_ty = cx.tables.expr_ty(arg); - let default_trait_id = if let Some(default_trait_id) = get_trait_def_id(cx, &*paths::DEFAULT_TRAIT) { + let default_trait_id = if let Some(default_trait_id) = get_trait_def_id(cx, &*paths::DEFAULT_TRAIT) + { default_trait_id } else { return false; @@ -2216,15 +2216,33 @@ fn lint_chars_cmp_with_unwrap<'a, 'tcx>( /// Checks for the `CHARS_NEXT_CMP` lint with `unwrap()`. fn lint_chars_next_cmp_with_unwrap<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, info: &BinaryExprInfo<'_>) -> bool { - lint_chars_cmp_with_unwrap(cx, info, &[*sym::chars, *sym::next, *sym::unwrap], CHARS_NEXT_CMP, "starts_with") + lint_chars_cmp_with_unwrap( + cx, + info, + &[*sym::chars, *sym::next, *sym::unwrap], + CHARS_NEXT_CMP, + "starts_with", + ) } /// Checks for the `CHARS_LAST_CMP` lint with `unwrap()`. fn lint_chars_last_cmp_with_unwrap<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, info: &BinaryExprInfo<'_>) -> bool { - if lint_chars_cmp_with_unwrap(cx, info, &[*sym::chars, *sym::last, *sym::unwrap], CHARS_LAST_CMP, "ends_with") { + if lint_chars_cmp_with_unwrap( + cx, + info, + &[*sym::chars, *sym::last, *sym::unwrap], + CHARS_LAST_CMP, + "ends_with", + ) { true } else { - lint_chars_cmp_with_unwrap(cx, info, &[*sym::chars, *sym::next_back, *sym::unwrap], CHARS_LAST_CMP, "ends_with") + lint_chars_cmp_with_unwrap( + cx, + info, + &[*sym::chars, *sym::next_back, *sym::unwrap], + CHARS_LAST_CMP, + "ends_with", + ) } } @@ -2288,10 +2306,7 @@ fn lint_asref(cx: &LateContext<'_, '_>, expr: &hir::Expr, call_name: &str, as_re } } -fn ty_has_iter_method( - cx: &LateContext<'_, '_>, - self_ref_ty: Ty<'_>, -) -> Option<(&'static Lint, Symbol, &'static str)> { +fn ty_has_iter_method(cx: &LateContext<'_, '_>, self_ref_ty: Ty<'_>) -> Option<(&'static Lint, Symbol, &'static str)> { if let Some(ty_name) = has_iter_method(cx, self_ref_ty) { let lint = if ty_name == *sym::array || ty_name == *sym::PathBuf { INTO_ITER_ON_ARRAY diff --git a/clippy_lints/src/minmax.rs b/clippy_lints/src/minmax.rs index 5f5b191893f..5a963457127 100644 --- a/clippy_lints/src/minmax.rs +++ b/clippy_lints/src/minmax.rs @@ -1,5 +1,5 @@ use crate::consts::{constant_simple, Constant}; -use crate::utils::{paths, span_lint, match_def_path}; +use crate::utils::{match_def_path, paths, span_lint}; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 992fad6e3cb..66a5ac6824f 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -505,7 +505,8 @@ fn check_to_owned(cx: &LateContext<'_, '_>, expr: &Expr, other: &Expr) { }, ExprKind::Call(ref path, ref v) if v.len() == 1 => { if let ExprKind::Path(ref path) = path.node { - if match_qpath(path, &[*sym::String, *sym::from_str]) || match_qpath(path, &[*sym::String, *sym::from]) { + if match_qpath(path, &[*sym::String, *sym::from_str]) || match_qpath(path, &[*sym::String, *sym::from]) + { (cx.tables.expr_ty_adjusted(&v[0]), snippet(cx, v[0].span, "..")) } else { return; diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index d28b8d8a85d..94c8e7ff709 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -5,8 +5,8 @@ // [`missing_doc`]: https://github.com/rust-lang/rust/blob/d6d05904697d89099b55da3331155392f1db9c00/src/librustc_lint/builtin.rs#L246 // -use crate::utils::{in_macro_or_desugar, span_lint}; use crate::utils::sym; +use crate::utils::{in_macro_or_desugar, span_lint}; use if_chain::if_chain; use rustc::hir; use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass}; diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs index daac70ff8ff..461e5885476 100644 --- a/clippy_lints/src/needless_borrow.rs +++ b/clippy_lints/src/needless_borrow.rs @@ -2,8 +2,8 @@ //! //! This lint is **warn** by default -use crate::utils::{in_macro_or_desugar, snippet_opt, span_lint_and_then}; use crate::utils::sym; +use crate::utils::{in_macro_or_desugar, snippet_opt, span_lint_and_then}; use if_chain::if_chain; use rustc::hir::{BindingAnnotation, Expr, ExprKind, HirId, Item, MutImmutable, Pat, PatKind}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index b75c705a494..7e2899bc7a9 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -1,6 +1,6 @@ use crate::utils::paths; -use crate::utils::sym; use crate::utils::sugg::DiagnosticBuilderExt; +use crate::utils::sym; use crate::utils::{get_trait_def_id, implements_trait, return_ty, same_tys, span_lint_hir_and_then}; use if_chain::if_chain; use rustc::hir; diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index 0da4c8090be..12976e05b08 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -1,5 +1,5 @@ -use crate::utils::{span_lint, span_lint_and_then}; use crate::utils::sym; +use crate::utils::{span_lint, span_lint_and_then}; use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use rustc::{declare_tool_lint, impl_lint_pass}; use syntax::ast::*; diff --git a/clippy_lints/src/ok_if_let.rs b/clippy_lints/src/ok_if_let.rs index c5c2c22e235..c097f17d30e 100644 --- a/clippy_lints/src/ok_if_let.rs +++ b/clippy_lints/src/ok_if_let.rs @@ -1,5 +1,5 @@ -use crate::utils::{match_type, method_chain_args, paths, snippet, span_help_and_lint}; use crate::utils::sym; +use crate::utils::{match_type, method_chain_args, paths, snippet, span_help_and_lint}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/open_options.rs b/clippy_lints/src/open_options.rs index 839b0ace517..fa3e589d92b 100644 --- a/clippy_lints/src/open_options.rs +++ b/clippy_lints/src/open_options.rs @@ -1,5 +1,5 @@ -use crate::utils::{match_type, paths, span_lint, walk_ptrs_ty}; use crate::utils::sym; +use crate::utils::{match_type, paths, span_lint, walk_ptrs_ty}; use rustc::hir::{Expr, ExprKind}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/panic_unimplemented.rs b/clippy_lints/src/panic_unimplemented.rs index a4ec838860b..8f896acbd3d 100644 --- a/clippy_lints/src/panic_unimplemented.rs +++ b/clippy_lints/src/panic_unimplemented.rs @@ -1,5 +1,5 @@ -use crate::utils::{is_direct_expn_of, is_expn_of, paths, resolve_node, span_lint, match_def_path}; use crate::utils::sym; +use crate::utils::{is_direct_expn_of, is_expn_of, match_def_path, paths, resolve_node, span_lint}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/partialeq_ne_impl.rs b/clippy_lints/src/partialeq_ne_impl.rs index 50b34b3fd34..3e146a72ab8 100644 --- a/clippy_lints/src/partialeq_ne_impl.rs +++ b/clippy_lints/src/partialeq_ne_impl.rs @@ -1,5 +1,5 @@ -use crate::utils::{is_automatically_derived, span_lint_hir}; use crate::utils::sym; +use crate::utils::{is_automatically_derived, span_lint_hir}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/path_buf_push_overwrite.rs b/clippy_lints/src/path_buf_push_overwrite.rs index b7b425cd08d..3234c81de23 100644 --- a/clippy_lints/src/path_buf_push_overwrite.rs +++ b/clippy_lints/src/path_buf_push_overwrite.rs @@ -1,5 +1,5 @@ -use crate::utils::{match_type, paths, span_lint_and_sugg, walk_ptrs_ty}; use crate::utils::sym; +use crate::utils::{match_type, paths, span_lint_and_sugg, walk_ptrs_ty}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index e47c66bbfec..8a6933b2f5a 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -194,7 +194,12 @@ fn check_fn(cx: &LateContext<'_, '_>, decl: &FnDecl, fn_id: HirId, opt_body_id: ); } } else if match_type(cx, ty, &*paths::STRING) { - if let Some(spans) = get_spans(cx, opt_body_id, idx, &[(*sym::clone, ".to_string()"), (*sym::as_str, "")]) { + if let Some(spans) = get_spans( + cx, + opt_body_id, + idx, + &[(*sym::clone, ".to_string()"), (*sym::as_str, "")], + ) { span_lint_and_then( cx, PTR_ARG, diff --git a/clippy_lints/src/question_mark.rs b/clippy_lints/src/question_mark.rs index 5f406452adc..1949101def9 100644 --- a/clippy_lints/src/question_mark.rs +++ b/clippy_lints/src/question_mark.rs @@ -7,9 +7,9 @@ use rustc_errors::Applicability; use syntax::ptr::P; use crate::utils::paths::*; -use crate::utils::sym; use crate::utils::sugg::Sugg; -use crate::utils::{higher, match_type, span_lint_and_then, SpanlessEq, match_def_path}; +use crate::utils::sym; +use crate::utils::{higher, match_def_path, match_type, span_lint_and_then, SpanlessEq}; declare_clippy_lint! { /// **What it does:** Checks for expressions that could be replaced by the question mark operator. diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index 75816090ca9..d5e71fdbec3 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -213,7 +213,8 @@ fn has_step_by(cx: &LateContext<'_, '_>, expr: &Expr) -> bool { // can't be called on a borrowed range. let ty = cx.tables.expr_ty_adjusted(expr); - get_trait_def_id(cx, &*paths::ITERATOR).map_or(false, |iterator_trait| implements_trait(cx, ty, iterator_trait, &[])) + get_trait_def_id(cx, &*paths::ITERATOR) + .map_or(false, |iterator_trait| implements_trait(cx, ty, iterator_trait, &[])) } fn y_plus_one(expr: &Expr) -> Option<&Expr> { diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 6e7ee3e1de3..53bfc15a509 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -1,6 +1,6 @@ use crate::utils::{ - has_drop, in_macro_or_desugar, is_copy, match_type, paths, snippet_opt, span_lint_hir, span_lint_hir_and_then, - walk_ptrs_ty_depth, match_def_path, + has_drop, in_macro_or_desugar, is_copy, match_def_path, match_type, paths, snippet_opt, span_lint_hir, + span_lint_hir_and_then, walk_ptrs_ty_depth, }; use if_chain::if_chain; use matches::matches; @@ -96,7 +96,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { let from_borrow = match_def_path(cx, fn_def_id, &*paths::CLONE_TRAIT_METHOD) || match_def_path(cx, fn_def_id, &*paths::TO_OWNED_METHOD) - || (match_def_path(cx, fn_def_id, &*paths::TO_STRING_METHOD) && match_type(cx, arg_ty, &*paths::STRING)); + || (match_def_path(cx, fn_def_id, &*paths::TO_STRING_METHOD) + && match_type(cx, arg_ty, &*paths::STRING)); let from_deref = !from_borrow && (match_def_path(cx, fn_def_id, &*paths::PATH_TO_PATH_BUF) diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index f7d6b46167e..59b1cc01671 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -1,6 +1,6 @@ use crate::consts::{constant, Constant}; -use crate::utils::{is_expn_of, match_type, paths, span_help_and_lint, span_lint, match_def_path}; use crate::utils::sym; +use crate::utils::{is_expn_of, match_def_path, match_type, paths, span_help_and_lint, span_lint}; use if_chain::if_chain; use regex_syntax; use rustc::hir::*; diff --git a/clippy_lints/src/replace_consts.rs b/clippy_lints/src/replace_consts.rs index 6c44fd24880..80ea39a301c 100644 --- a/clippy_lints/src/replace_consts.rs +++ b/clippy_lints/src/replace_consts.rs @@ -1,13 +1,13 @@ -use crate::utils::{span_lint_and_sugg, match_def_path}; use crate::utils::sym; +use crate::utils::{match_def_path, span_lint_and_sugg}; use if_chain::if_chain; +use lazy_static::lazy_static; use rustc::hir; use rustc::hir::def::{DefKind, Res}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; use rustc_errors::Applicability; use syntax::symbol::Symbol; -use lazy_static::lazy_static; declare_clippy_lint! { /// **What it does:** Checks for usage of `ATOMIC_X_INIT`, `ONCE_INIT`, and diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index eac3bf22f97..0764a96e263 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -7,8 +7,8 @@ use syntax::source_map::Span; use syntax::visit::FnKind; use syntax_pos::BytePos; -use crate::utils::{in_macro_or_desugar, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint}; use crate::utils::sym; +use crate::utils::{in_macro_or_desugar, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint}; declare_clippy_lint! { /// **What it does:** Checks for return statements at the end of a block. diff --git a/clippy_lints/src/slow_vector_initialization.rs b/clippy_lints/src/slow_vector_initialization.rs index 8cf4d15c59c..d84602c5c78 100644 --- a/clippy_lints/src/slow_vector_initialization.rs +++ b/clippy_lints/src/slow_vector_initialization.rs @@ -1,6 +1,6 @@ use crate::utils::sugg::Sugg; -use crate::utils::{get_enclosing_block, match_qpath, span_lint_and_then, SpanlessEq}; use crate::utils::sym; +use crate::utils::{get_enclosing_block, match_qpath, span_lint_and_then, SpanlessEq}; use if_chain::if_chain; use rustc::hir::intravisit::{walk_block, walk_expr, walk_stmt, NestedVisitorMap, Visitor}; use rustc::hir::*; diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index 9f56a3b251b..b6b0ca822c8 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -4,8 +4,8 @@ use rustc::{declare_lint_pass, declare_tool_lint}; use rustc_errors::Applicability; use syntax::source_map::Spanned; -use crate::utils::SpanlessEq; use crate::utils::sym; +use crate::utils::SpanlessEq; use crate::utils::{get_parent_expr, is_allowed, match_type, paths, span_lint, span_lint_and_sugg, walk_ptrs_ty}; declare_clippy_lint! { diff --git a/clippy_lints/src/suspicious_trait_impl.rs b/clippy_lints/src/suspicious_trait_impl.rs index f72221f63a7..ecc033937ab 100644 --- a/clippy_lints/src/suspicious_trait_impl.rs +++ b/clippy_lints/src/suspicious_trait_impl.rs @@ -1,5 +1,5 @@ -use crate::utils::{get_trait_def_id, span_lint, trait_ref_of_method}; use crate::utils::sym; +use crate::utils::{get_trait_def_id, span_lint, trait_ref_of_method}; use if_chain::if_chain; use rustc::hir; use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 767b9e9dbe1..45d80e3f5e3 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -1,4 +1,4 @@ -use crate::utils::{last_path_segment, paths, snippet, span_lint, span_lint_and_then, sugg, match_def_path}; +use crate::utils::{last_path_segment, match_def_path, paths, snippet, span_lint, span_lint_and_then, sugg}; use if_chain::if_chain; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; diff --git a/clippy_lints/src/transmuting_null.rs b/clippy_lints/src/transmuting_null.rs index 76a59086ee1..90623d531ad 100644 --- a/clippy_lints/src/transmuting_null.rs +++ b/clippy_lints/src/transmuting_null.rs @@ -1,5 +1,5 @@ use crate::consts::{constant_context, Constant}; -use crate::utils::{paths, match_qpath, span_lint}; +use crate::utils::{match_qpath, paths, span_lint}; use if_chain::if_chain; use rustc::hir::{Expr, ExprKind}; use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass}; diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index cc5382b0261..3dffcc7361b 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -1,7 +1,7 @@ use std::cmp; -use crate::utils::{in_macro_or_desugar, is_copy, is_self_ty, snippet, span_lint_and_sugg}; use crate::utils::sym; +use crate::utils::{in_macro_or_desugar, is_copy, is_self_ty, snippet, span_lint_and_sugg}; use if_chain::if_chain; use matches::matches; use rustc::hir; diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 08b4871dee2..cf637ceb706 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -22,12 +22,12 @@ use syntax::symbol::Symbol; use crate::consts::{constant, Constant}; use crate::utils::paths; +use crate::utils::sym; use crate::utils::{ clip, comparisons, differing_macro_contexts, higher, in_constant, in_macro_or_desugar, int_bits, last_path_segment, - match_path, multispan_sugg, same_tys, sext, snippet, snippet_opt, snippet_with_applicability, span_help_and_lint, - span_lint, span_lint_and_sugg, span_lint_and_then, unsext, match_def_path, + match_def_path, match_path, multispan_sugg, same_tys, sext, snippet, snippet_opt, snippet_with_applicability, + span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, unsext, }; -use crate::utils::sym; declare_clippy_lint! { /// **What it does:** Checks for use of `Box<Vec<_>>` anywhere in the code. diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs index e64e4536510..9949a086f93 100644 --- a/clippy_lints/src/unwrap.rs +++ b/clippy_lints/src/unwrap.rs @@ -2,10 +2,10 @@ use if_chain::if_chain; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint}; +use crate::utils::sym; use crate::utils::{ higher::if_block, in_macro_or_desugar, match_type, paths, span_lint_and_then, usage::is_potentially_mutated, }; -use crate::utils::sym; use rustc::hir::intravisit::*; use rustc::hir::*; use syntax::source_map::Span; diff --git a/clippy_lints/src/utils/conf.rs b/clippy_lints/src/utils/conf.rs index cae2b083a53..1c71a76f159 100644 --- a/clippy_lints/src/utils/conf.rs +++ b/clippy_lints/src/utils/conf.rs @@ -2,8 +2,8 @@ #![deny(clippy::missing_docs_in_private_items)] -use lazy_static::lazy_static; use crate::utils::sym; +use lazy_static::lazy_static; use std::default::Default; use std::io::Read; use std::sync::Mutex; diff --git a/clippy_lints/src/utils/higher.rs b/clippy_lints/src/utils/higher.rs index 370d319dc15..610d0c93216 100644 --- a/clippy_lints/src/utils/higher.rs +++ b/clippy_lints/src/utils/higher.rs @@ -3,8 +3,8 @@ #![deny(clippy::missing_docs_in_private_items)] -use crate::utils::{is_expn_of, match_def_path, match_qpath, paths, resolve_node}; use crate::utils::sym; +use crate::utils::{is_expn_of, match_def_path, match_qpath, paths, resolve_node}; use if_chain::if_chain; use rustc::lint::LateContext; use rustc::{hir, ty}; @@ -102,7 +102,8 @@ pub fn range<'a, 'b, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'b hir::Expr) -> O }, hir::ExprKind::Call(ref path, ref args) => { if let hir::ExprKind::Path(ref path) = path.node { - if match_qpath(path, &*paths::RANGE_INCLUSIVE_STD_NEW) || match_qpath(path, &*paths::RANGE_INCLUSIVE_NEW) + if match_qpath(path, &*paths::RANGE_INCLUSIVE_STD_NEW) + || match_qpath(path, &*paths::RANGE_INCLUSIVE_NEW) { Some(Range { start: Some(&args[0]), @@ -129,7 +130,8 @@ pub fn range<'a, 'b, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'b hir::Expr) -> O end: Some(get_field(*sym::end, fields)?), limits: ast::RangeLimits::HalfOpen, }) - } else if match_qpath(path, &*paths::RANGE_TO_INCLUSIVE_STD) || match_qpath(path, &*paths::RANGE_TO_INCLUSIVE) + } else if match_qpath(path, &*paths::RANGE_TO_INCLUSIVE_STD) + || match_qpath(path, &*paths::RANGE_TO_INCLUSIVE) { Some(Range { start: None, diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index 275fd99fd5e..3ba2cd38c35 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -1,4 +1,4 @@ -use crate::utils::{match_type, match_def_path, paths, span_help_and_lint, span_lint, walk_ptrs_ty}; +use crate::utils::{match_def_path, match_type, paths, span_help_and_lint, span_lint, walk_ptrs_ty}; use if_chain::if_chain; use rustc::hir; use rustc::hir::def::{DefKind, Res}; diff --git a/clippy_lints/src/utils/paths.rs b/clippy_lints/src/utils/paths.rs index 88fd6141592..46c2de74d72 100644 --- a/clippy_lints/src/utils/paths.rs +++ b/clippy_lints/src/utils/paths.rs @@ -4,118 +4,120 @@ #![allow(default_hash_types)] // we just look at symbol names, which is good enough everywhere else use super::sym::{self, *}; -use syntax::symbol::Symbol; use lazy_static::lazy_static; +use syntax::symbol::Symbol; lazy_static! { -pub static ref ANY_TRAIT: [Symbol; 3] = [*std, *any, *Any]; -pub static ref ARC: [Symbol; 3] = [*alloc, *sync, *Arc]; -pub static ref ASMUT_TRAIT: [Symbol; 3] = [*core, *convert, *sym::AsMut]; -pub static ref ASREF_TRAIT: [Symbol; 3] = [*core, *convert, *sym::AsRef]; -pub static ref BEGIN_PANIC: [Symbol; 3] = [*std, *panicking, *begin_panic]; -pub static ref BEGIN_PANIC_FMT: [Symbol; 3] = [*std, *panicking, *begin_panic_fmt]; -pub static ref BINARY_HEAP: [Symbol; 4] = [*alloc, *collections, *binary_heap, *BinaryHeap]; -pub static ref BORROW_TRAIT: [Symbol; 3] = [*core, *borrow, *Borrow]; -pub static ref BTREEMAP: [Symbol; 5] = [*alloc, *collections, *btree, *map, *BTreeMap]; -pub static ref BTREEMAP_ENTRY: [Symbol; 5] = [*alloc, *collections, *btree, *map, *Entry]; -pub static ref BTREESET: [Symbol; 5] = [*alloc, *collections, *btree, *set, *BTreeSet]; -pub static ref CLONE_TRAIT: [Symbol; 3] = [*core, *clone, *sym::Clone]; -pub static ref CLONE_TRAIT_METHOD: [Symbol; 4] = [*core, *clone, *sym::Clone, *clone]; -pub static ref CMP_MAX: [Symbol; 3] = [*core, *cmp, *max]; -pub static ref CMP_MIN: [Symbol; 3] = [*core, *cmp, *min]; -pub static ref COW: [Symbol; 3] = [*alloc, *borrow, *Cow]; -pub static ref CSTRING_NEW: [Symbol; 5] = [*std, *ffi, *c_str, *CString, *new]; -pub static ref DEFAULT_TRAIT: [Symbol; 3] = [*core, *default, *sym::Default]; -pub static ref DEFAULT_TRAIT_METHOD: [Symbol; 4] = [*core, *default, *sym::Default, *default]; -pub static ref DEREF_TRAIT_METHOD: [Symbol; 5] = [*core, *ops, *deref, *Deref, *deref]; -pub static ref DISPLAY_FMT_METHOD: [Symbol; 4] = [*core, *fmt, *Display, *fmt]; -pub static ref DOUBLE_ENDED_ITERATOR: [Symbol; 4] = [*core, *iter, *traits, *sym::DoubleEndedIterator]; -pub static ref DROP: [Symbol; 3] = [*core, *mem, *drop]; -pub static ref DROP_TRAIT: [Symbol; 4] = [*core, *ops, *drop, *sym::Drop]; -pub static ref DURATION: [Symbol; 3] = [*core, *time, *Duration]; -pub static ref EARLY_CONTEXT: [Symbol; 4] = [*rustc, *lint, *context, *EarlyContext]; -pub static ref FMT_ARGUMENTS_NEWV1: [Symbol; 4] = [*core, *fmt, *Arguments, *new_v1]; -pub static ref FMT_ARGUMENTS_NEWV1FORMATTED: [Symbol; 4] = [*core, *fmt, *Arguments, *new_v1_formatted]; -pub static ref FROM_FROM: [Symbol; 4] = [*core, *convert, *sym::From, *from]; -pub static ref FROM_TRAIT: [Symbol; 3] = [*core, *convert, *sym::From]; -pub static ref HASH: [Symbol; 2] = [*hash, *Hash]; -pub static ref HASHMAP: [Symbol; 5] = [*std, *collections, *hash, *map, *HashMap]; -pub static ref HASHMAP_ENTRY: [Symbol; 5] = [*std, *collections, *hash, *map, *Entry]; -pub static ref HASHSET: [Symbol; 5] = [*std, *collections, *hash, *set, *HashSet]; -pub static ref INDEX: [Symbol; 3] = [*core, *ops, *Index]; -pub static ref INDEX_MUT: [Symbol; 3] = [*core, *ops, *IndexMut]; -pub static ref INIT: [Symbol; 4] = [*core, *intrinsics, *empty_symbol, *init]; -pub static ref INTO: [Symbol; 3] = [*core, *convert, *sym::Into]; -pub static ref INTO_ITERATOR: [Symbol; 5] = [*core, *iter, *traits, *collect, *sym::IntoIterator]; -pub static ref IO_READ: [Symbol; 3] = [*std, *io, *Read]; -pub static ref IO_WRITE: [Symbol; 3] = [*std, *io, *Write]; -pub static ref ITERATOR: [Symbol; 5] = [*core, *iter, *traits, *iterator, *sym::Iterator]; -pub static ref LATE_CONTEXT: [Symbol; 4] = [*rustc, *lint, *context, *LateContext]; -pub static ref LINKED_LIST: [Symbol; 4] = [*alloc, *collections, *linked_list, *LinkedList]; -pub static ref LINT: [Symbol; 3] = [*rustc, *lint, *Lint]; -pub static ref LINT_PASS: [Symbol; 3] = [*rustc, *lint, *LintPass]; -pub static ref MEM_DISCRIMINANT: [Symbol; 3] = [*core, *mem, *discriminant]; -pub static ref MEM_FORGET: [Symbol; 3] = [*core, *mem, *forget]; -pub static ref MEM_REPLACE: [Symbol; 3] = [*core, *mem, *replace]; -pub static ref MEM_UNINIT: [Symbol; 3] = [*core, *mem, *uninitialized]; -pub static ref MEM_ZEROED: [Symbol; 3] = [*core, *mem, *zeroed]; -pub static ref MUTEX: [Symbol; 4] = [*std, *sync, *mutex, *Mutex]; -pub static ref OPEN_OPTIONS: [Symbol; 3] = [*std, *fs, *OpenOptions]; -pub static ref OPS_MODULE: [Symbol; 2] = [*core, *ops]; -pub static ref OPTION: [Symbol; 3] = [*core, *option, *sym::Option]; -pub static ref OPTION_NONE: [Symbol; 4] = [*core, *option, *sym::Option, *sym::None]; -pub static ref OPTION_SOME: [Symbol; 4] = [*core, *option, *sym::Option, *sym::Some]; -pub static ref ORD: [Symbol; 3] = [*core, *cmp, *sym::Ord]; -pub static ref OS_STRING: [Symbol; 4] = [*std, *ffi, *os_str, *OsString]; -pub static ref OS_STR_TO_OS_STRING: [Symbol; 5] = [*std, *ffi, *os_str, *OsStr, *to_os_string]; -pub static ref PARTIAL_ORD: [Symbol; 3] = [*core, *cmp, *sym::PartialOrd]; -pub static ref PATH: [Symbol; 3] = [*std, *path, *Path]; -pub static ref PATH_BUF: [Symbol; 3] = [*std, *path, *PathBuf]; -pub static ref PATH_TO_PATH_BUF: [Symbol; 4] = [*std, *path, *Path, *to_path_buf]; -pub static ref PTR_NULL: [Symbol; 2] = [*ptr, *null]; -pub static ref PTR_NULL_MUT: [Symbol; 2] = [*ptr, *null_mut]; -pub static ref RANGE: [Symbol; 3] = [*core, *ops, *Range]; -pub static ref RANGE_ARGUMENT_TRAIT: [Symbol; 3] = [*core, *ops, *RangeBounds]; -pub static ref RANGE_FROM: [Symbol; 3] = [*core, *ops, *RangeFrom]; -pub static ref RANGE_FROM_STD: [Symbol; 3] = [*std, *ops, *RangeFrom]; -pub static ref RANGE_FULL: [Symbol; 3] = [*core, *ops, *RangeFull]; -pub static ref RANGE_FULL_STD: [Symbol; 3] = [*std, *ops, *RangeFull]; -pub static ref RANGE_INCLUSIVE_NEW: [Symbol; 4] = [*core, *ops, *RangeInclusive, *new]; -pub static ref RANGE_INCLUSIVE_STD_NEW: [Symbol; 4] = [*std, *ops, *RangeInclusive, *new]; -pub static ref RANGE_STD: [Symbol; 3] = [*std, *ops, *Range]; -pub static ref RANGE_TO: [Symbol; 3] = [*core, *ops, *RangeTo]; -pub static ref RANGE_TO_INCLUSIVE: [Symbol; 3] = [*core, *ops, *RangeToInclusive]; -pub static ref RANGE_TO_INCLUSIVE_STD: [Symbol; 3] = [*std, *ops, *RangeToInclusive]; -pub static ref RANGE_TO_STD: [Symbol; 3] = [*std, *ops, *RangeTo]; -pub static ref RC: [Symbol; 3] = [*alloc, *rc, *Rc]; -pub static ref RECEIVER: [Symbol; 4] = [*std, *sync, *mpsc, *Receiver]; -pub static ref REGEX: [Symbol; 3] = [*regex, *re_unicode, *Regex]; -pub static ref REGEX_BUILDER_NEW: [Symbol; 5] = [*regex, *re_builder, *unicode, *RegexBuilder, *new]; -pub static ref REGEX_BYTES_BUILDER_NEW: [Symbol; 5] = [*regex, *re_builder, *bytes, *RegexBuilder, *new]; -pub static ref REGEX_BYTES_NEW: [Symbol; 4] = [*regex, *re_bytes, *Regex, *new]; -pub static ref REGEX_BYTES_SET_NEW: [Symbol; 5] = [*regex, *re_set, *bytes, *RegexSet, *new]; -pub static ref REGEX_NEW: [Symbol; 4] = [*regex, *re_unicode, *Regex, *new]; -pub static ref REGEX_SET_NEW: [Symbol; 5] = [*regex, *re_set, *unicode, *RegexSet, *new]; -pub static ref REPEAT: [Symbol; 3] = [*core, *iter, *repeat]; -pub static ref RESULT: [Symbol; 3] = [*core, *result, *sym::Result]; -pub static ref RESULT_ERR: [Symbol; 4] = [*core, *result, *sym::Result, *sym::Err]; -pub static ref RESULT_OK: [Symbol; 4] = [*core, *result, *sym::Result, *sym::Ok]; -pub static ref SERDE_DE_VISITOR: [Symbol; 3] = [*serde, *de, *Visitor]; -pub static ref SLICE_INTO_VEC: [Symbol; 4] = [*alloc, *slice, *impl_slice_t, *into_vec]; -pub static ref SLICE_ITER: [Symbol; 3] = [*core, *slice, *Iter]; -pub static ref STD_MEM_TRANSMUTE: [Symbol; 3] = [*std, *mem, *transmute]; -pub static ref STD_PTR_NULL: [Symbol; 3] = [*std, *ptr, *null]; -pub static ref STRING: [Symbol; 3] = [*alloc, *string, *sym::String]; -pub static ref TO_OWNED: [Symbol; 3] = [*alloc, *borrow, *sym::ToOwned]; -pub static ref TO_OWNED_METHOD: [Symbol; 4] = [*alloc, *borrow, *sym::ToOwned, *to_owned]; -pub static ref TO_STRING: [Symbol; 3] = [*alloc, *string, *sym::ToString]; -pub static ref TO_STRING_METHOD: [Symbol; 4] = [*alloc, *string, *sym::ToString, *to_string]; -pub static ref TRANSMUTE: [Symbol; 4] = [*core, *intrinsics, *empty_symbol, *transmute]; -pub static ref TRY_INTO_RESULT: [Symbol; 4] = [*std, *ops, *Try, *into_result]; -pub static ref UNINIT: [Symbol; 4] = [*core, *intrinsics, *empty_symbol, *uninit]; -pub static ref VEC: [Symbol; 3] = [*alloc, *vec, *sym::Vec]; -pub static ref VEC_DEQUE: [Symbol; 4] = [*alloc, *collections, *vec_deque, *VecDeque]; -pub static ref VEC_FROM_ELEM: [Symbol; 3] = [*alloc, *vec, *from_elem]; -pub static ref WEAK_ARC: [Symbol; 3] = [*alloc, *sync, *Weak]; -pub static ref WEAK_RC: [Symbol; 3] = [*alloc, *rc, *Weak]; + pub static ref ANY_TRAIT: [Symbol; 3] = [*std, *any, *Any]; + pub static ref ARC: [Symbol; 3] = [*alloc, *sync, *Arc]; + pub static ref ASMUT_TRAIT: [Symbol; 3] = [*core, *convert, *sym::AsMut]; + pub static ref ASREF_TRAIT: [Symbol; 3] = [*core, *convert, *sym::AsRef]; + pub static ref BEGIN_PANIC: [Symbol; 3] = [*std, *panicking, *begin_panic]; + pub static ref BEGIN_PANIC_FMT: [Symbol; 3] = [*std, *panicking, *begin_panic_fmt]; + pub static ref BINARY_HEAP: [Symbol; 4] = [*alloc, *collections, *binary_heap, *BinaryHeap]; + pub static ref BORROW_TRAIT: [Symbol; 3] = [*core, *borrow, *Borrow]; + pub static ref BTREEMAP: [Symbol; 5] = [*alloc, *collections, *btree, *map, *BTreeMap]; + pub static ref BTREEMAP_ENTRY: [Symbol; 5] = [*alloc, *collections, *btree, *map, *Entry]; + pub static ref BTREESET: [Symbol; 5] = [*alloc, *collections, *btree, *set, *BTreeSet]; + pub static ref CLONE_TRAIT: [Symbol; 3] = [*core, *clone, *sym::Clone]; + pub static ref CLONE_TRAIT_METHOD: [Symbol; 4] = [*core, *clone, *sym::Clone, *clone]; + pub static ref CMP_MAX: [Symbol; 3] = [*core, *cmp, *max]; + pub static ref CMP_MIN: [Symbol; 3] = [*core, *cmp, *min]; + pub static ref COW: [Symbol; 3] = [*alloc, *borrow, *Cow]; + pub static ref CSTRING_NEW: [Symbol; 5] = [*std, *ffi, *c_str, *CString, *new]; + pub static ref DEFAULT_TRAIT: [Symbol; 3] = [*core, *default, *sym::Default]; + pub static ref DEFAULT_TRAIT_METHOD: [Symbol; 4] = [*core, *default, *sym::Default, *default]; + pub static ref DEREF_TRAIT_METHOD: [Symbol; 5] = [*core, *ops, *deref, *Deref, *deref]; + pub static ref DISPLAY_FMT_METHOD: [Symbol; 4] = [*core, *fmt, *Display, *fmt]; + pub static ref DOUBLE_ENDED_ITERATOR: [Symbol; 4] = [*core, *iter, *traits, *sym::DoubleEndedIterator]; + pub static ref DROP: [Symbol; 3] = [*core, *mem, *drop]; + pub static ref DROP_TRAIT: [Symbol; 4] = [*core, *ops, *drop, *sym::Drop]; + pub static ref DURATION: [Symbol; 3] = [*core, *time, *Duration]; + pub static ref EARLY_CONTEXT: [Symbol; 4] = [*rustc, *lint, *context, *EarlyContext]; + pub static ref FMT_ARGUMENTS_NEWV1: [Symbol; 4] = [*core, *fmt, *Arguments, *new_v1]; + pub static ref FMT_ARGUMENTS_NEWV1FORMATTED: [Symbol; 4] = [*core, *fmt, *Arguments, *new_v1_formatted]; + pub static ref FROM_FROM: [Symbol; 4] = [*core, *convert, *sym::From, *from]; + pub static ref FROM_TRAIT: [Symbol; 3] = [*core, *convert, *sym::From]; + pub static ref HASH: [Symbol; 2] = [*hash, *Hash]; + pub static ref HASHMAP: [Symbol; 5] = [*std, *collections, *hash, *map, *HashMap]; + pub static ref HASHMAP_ENTRY: [Symbol; 5] = [*std, *collections, *hash, *map, *Entry]; + pub static ref HASHSET: [Symbol; 5] = [*std, *collections, *hash, *set, *HashSet]; + pub static ref INDEX: [Symbol; 3] = [*core, *ops, *Index]; + pub static ref INDEX_MUT: [Symbol; 3] = [*core, *ops, *IndexMut]; + pub static ref INIT: [Symbol; 4] = [*core, *intrinsics, *empty_symbol, *init]; + pub static ref INTO: [Symbol; 3] = [*core, *convert, *sym::Into]; + pub static ref INTO_ITERATOR: [Symbol; 5] = [*core, *iter, *traits, *collect, *sym::IntoIterator]; + pub static ref IO_READ: [Symbol; 3] = [*std, *io, *Read]; + pub static ref IO_WRITE: [Symbol; 3] = [*std, *io, *Write]; + pub static ref ITERATOR: [Symbol; 5] = [*core, *iter, *traits, *iterator, *sym::Iterator]; + pub static ref LATE_CONTEXT: [Symbol; 4] = [*rustc, *lint, *context, *LateContext]; + pub static ref LINKED_LIST: [Symbol; 4] = [*alloc, *collections, *linked_list, *LinkedList]; + pub static ref LINT: [Symbol; 3] = [*rustc, *lint, *Lint]; + pub static ref LINT_PASS: [Symbol; 3] = [*rustc, *lint, *LintPass]; + pub static ref MEM_DISCRIMINANT: [Symbol; 3] = [*core, *mem, *discriminant]; + pub static ref MEM_FORGET: [Symbol; 3] = [*core, *mem, *forget]; + pub static ref MEM_REPLACE: [Symbol; 3] = [*core, *mem, *replace]; + pub static ref MEM_UNINIT: [Symbol; 3] = [*core, *mem, *uninitialized]; + pub static ref MEM_ZEROED: [Symbol; 3] = [*core, *mem, *zeroed]; + pub static ref MUTEX: [Symbol; 4] = [*std, *sync, *mutex, *Mutex]; + pub static ref OPEN_OPTIONS: [Symbol; 3] = [*std, *fs, *OpenOptions]; + pub static ref OPS_MODULE: [Symbol; 2] = [*core, *ops]; + pub static ref OPTION: [Symbol; 3] = [*core, *option, *sym::Option]; + pub static ref OPTION_NONE: [Symbol; 4] = [*core, *option, *sym::Option, *sym::None]; + pub static ref OPTION_SOME: [Symbol; 4] = [*core, *option, *sym::Option, *sym::Some]; + pub static ref ORD: [Symbol; 3] = [*core, *cmp, *sym::Ord]; + pub static ref OS_STRING: [Symbol; 4] = [*std, *ffi, *os_str, *OsString]; + pub static ref OS_STR_TO_OS_STRING: [Symbol; 5] = [*std, *ffi, *os_str, *OsStr, *to_os_string]; + pub static ref PARTIAL_ORD: [Symbol; 3] = [*core, *cmp, *sym::PartialOrd]; + pub static ref PATH: [Symbol; 3] = [*std, *path, *Path]; + pub static ref PATH_BUF: [Symbol; 3] = [*std, *path, *PathBuf]; + pub static ref PATH_TO_PATH_BUF: [Symbol; 4] = [*std, *path, *Path, *to_path_buf]; + pub static ref PTR_NULL: [Symbol; 2] = [*ptr, *null]; + pub static ref PTR_NULL_MUT: [Symbol; 2] = [*ptr, *null_mut]; + pub static ref RANGE: [Symbol; 3] = [*core, *ops, *Range]; + pub static ref RANGE_ARGUMENT_TRAIT: [Symbol; 3] = [*core, *ops, *RangeBounds]; + pub static ref RANGE_FROM: [Symbol; 3] = [*core, *ops, *RangeFrom]; + pub static ref RANGE_FROM_STD: [Symbol; 3] = [*std, *ops, *RangeFrom]; + pub static ref RANGE_FULL: [Symbol; 3] = [*core, *ops, *RangeFull]; + pub static ref RANGE_FULL_STD: [Symbol; 3] = [*std, *ops, *RangeFull]; + pub static ref RANGE_INCLUSIVE_NEW: [Symbol; 4] = [*core, *ops, *RangeInclusive, *new]; + pub static ref RANGE_INCLUSIVE_STD_NEW: [Symbol; 4] = [*std, *ops, *RangeInclusive, *new]; + pub static ref RANGE_STD: [Symbol; 3] = [*std, *ops, *Range]; + pub static ref RANGE_TO: [Symbol; 3] = [*core, *ops, *RangeTo]; + pub static ref RANGE_TO_INCLUSIVE: [Symbol; 3] = [*core, *ops, *RangeToInclusive]; + pub static ref RANGE_TO_INCLUSIVE_STD: [Symbol; 3] = [*std, *ops, *RangeToInclusive]; + pub static ref RANGE_TO_STD: [Symbol; 3] = [*std, *ops, *RangeTo]; + pub static ref RC: [Symbol; 3] = [*alloc, *rc, *Rc]; + pub static ref RECEIVER: [Symbol; 4] = [*std, *sync, *mpsc, *Receiver]; + pub static ref REGEX: [Symbol; 3] = [*regex, *re_unicode, *Regex]; + pub static ref REGEX_BUILDER_NEW: [Symbol; 5] = [*regex, *re_builder, *unicode, *RegexBuilder, *new]; + pub static ref REGEX_BYTES_BUILDER_NEW: [Symbol; 5] = [*regex, *re_builder, *bytes, *RegexBuilder, *new]; + pub static ref REGEX_BYTES_NEW: [Symbol; 4] = [*regex, *re_bytes, *Regex, *new]; + pub static ref REGEX_BYTES_SET_NEW: [Symbol; 5] = [*regex, *re_set, *bytes, *RegexSet, *new]; + pub static ref REGEX_NEW: [Symbol; 4] = [*regex, *re_unicode, *Regex, *new]; + pub static ref REGEX_SET_NEW: [Symbol; 5] = [*regex, *re_set, *unicode, *RegexSet, *new]; + pub static ref REPEAT: [Symbol; 3] = [*core, *iter, *repeat]; + pub static ref RESULT: [Symbol; 3] = [*core, *result, *sym::Result]; + pub static ref RESULT_ERR: [Symbol; 4] = [*core, *result, *sym::Result, *sym::Err]; + pub static ref RESULT_OK: [Symbol; 4] = [*core, *result, *sym::Result, *sym::Ok]; + pub static ref SERDE_DE_VISITOR: [Symbol; 3] = [*serde, *de, *Visitor]; + pub static ref SLICE_INTO_VEC: [Symbol; 4] = [*alloc, *slice, *impl_slice_t, *into_vec]; + pub static ref SLICE_ITER: [Symbol; 3] = [*core, *slice, *Iter]; + pub static ref STD_MEM_TRANSMUTE: [Symbol; 3] = [*std, *mem, *transmute]; + pub static ref STD_PTR_NULL: [Symbol; 3] = [*std, *ptr, *null]; + pub static ref STDERR: [Symbol; 4] = [*std, *io, *stdio, *stderr]; + pub static ref STDOUT: [Symbol; 4] = [*std, *io, *stdio, *stdout]; + pub static ref STRING: [Symbol; 3] = [*alloc, *string, *sym::String]; + pub static ref TO_OWNED: [Symbol; 3] = [*alloc, *borrow, *sym::ToOwned]; + pub static ref TO_OWNED_METHOD: [Symbol; 4] = [*alloc, *borrow, *sym::ToOwned, *to_owned]; + pub static ref TO_STRING: [Symbol; 3] = [*alloc, *string, *sym::ToString]; + pub static ref TO_STRING_METHOD: [Symbol; 4] = [*alloc, *string, *sym::ToString, *to_string]; + pub static ref TRANSMUTE: [Symbol; 4] = [*core, *intrinsics, *empty_symbol, *transmute]; + pub static ref TRY_INTO_RESULT: [Symbol; 4] = [*std, *ops, *Try, *into_result]; + pub static ref UNINIT: [Symbol; 4] = [*core, *intrinsics, *empty_symbol, *uninit]; + pub static ref VEC: [Symbol; 3] = [*alloc, *vec, *sym::Vec]; + pub static ref VEC_DEQUE: [Symbol; 4] = [*alloc, *collections, *vec_deque, *VecDeque]; + pub static ref VEC_FROM_ELEM: [Symbol; 3] = [*alloc, *vec, *from_elem]; + pub static ref WEAK_ARC: [Symbol; 3] = [*alloc, *sync, *Weak]; + pub static ref WEAK_RC: [Symbol; 3] = [*alloc, *rc, *Weak]; } diff --git a/clippy_lints/src/utils/ptr.rs b/clippy_lints/src/utils/ptr.rs index 867d160fb89..a0096b2a653 100644 --- a/clippy_lints/src/utils/ptr.rs +++ b/clippy_lints/src/utils/ptr.rs @@ -1,5 +1,5 @@ -use crate::utils::{get_pat_name, match_var, snippet}; use crate::utils::sym; +use crate::utils::{get_pat_name, match_var, snippet}; use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc::hir::*; use rustc::lint::LateContext; diff --git a/clippy_lints/src/utils/sym.rs b/clippy_lints/src/utils/sym.rs index 69eecc75bfb..263d2d42ff4 100644 --- a/clippy_lints/src/utils/sym.rs +++ b/clippy_lints/src/utils/sym.rs @@ -1,7 +1,7 @@ #![allow(default_hash_types, non_upper_case_globals)] -use syntax::symbol::Symbol; use lazy_static::lazy_static; +use syntax::symbol::Symbol; macro_rules! symbols_simple { ($($ident:ident,)*) => { @@ -26,17 +26,17 @@ macro_rules! symbols_init { // exists because concat_idents is flaky pub mod assign { pub(crate) use super::AddAssign as Add; - pub(crate) use super::SubAssign as Sub; - pub(crate) use super::MulAssign as Mul; - pub(crate) use super::DivAssign as Div; - pub(crate) use super::RemAssign as Rem; pub(crate) use super::AndAssign as And; - pub(crate) use super::OrAssign as Or; pub(crate) use super::BitAndAssign as BitAnd; pub(crate) use super::BitOrAssign as BitOr; pub(crate) use super::BitXorAssign as BitXor; - pub(crate) use super::ShrAssign as Shr; + pub(crate) use super::DivAssign as Div; + pub(crate) use super::MulAssign as Mul; + pub(crate) use super::OrAssign as Or; + pub(crate) use super::RemAssign as Rem; pub(crate) use super::ShlAssign as Shl; + pub(crate) use super::ShrAssign as Shr; + pub(crate) use super::SubAssign as Sub; } symbols_simple! { @@ -387,7 +387,6 @@ symbols_simple! { zip, } - symbols_init! { impl_slice_t: "<impl [T]>", empty_symbol: "", |
