use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::{self, TypeFoldable};
use rustc_session::{declare_lint_pass, declare_tool_lint};
-use rustc_span::Span;
+use rustc_span::{sym, Span};
use rustc_target::spec::abi::Abi;
use rustc_trait_selection::traits;
use rustc_trait_selection::traits::misc::can_type_implement_copy;
// Exclude non-inherent impls
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
- if matches!(item.kind, ItemKind::Impl{ of_trait: Some(_), .. } |
- ItemKind::Trait(..))
- {
+ if matches!(
+ item.kind,
+ ItemKind::Impl { of_trait: Some(_), .. } | ItemKind::Trait(..)
+ ) {
return;
}
}
};
let fn_sig = cx.tcx.fn_sig(fn_def_id);
- let fn_sig = cx.tcx.erase_late_bound_regions(&fn_sig);
+ let fn_sig = cx.tcx.erase_late_bound_regions(fn_sig);
for (idx, ((input, &ty), arg)) in decl.inputs.iter().zip(fn_sig.inputs()).zip(body.params).enumerate() {
// All spans generated from a proc-macro invocation are the same...
let deref_span = spans_need_deref.get(&canonical_id);
if_chain! {
- if is_type_diagnostic_item(cx, ty, sym!(vec_type));
+ if is_type_diagnostic_item(cx, ty, sym::vec_type);
if let Some(clone_spans) =
get_spans(cx, Some(body.id()), idx, &[("clone", ".to_owned()")]);
if let TyKind::Path(QPath::Resolved(_, ref path)) = input.kind;
if let Some(elem_ty) = path.segments.iter()
- .find(|seg| seg.ident.name == sym!(Vec))
+ .find(|seg| seg.ident.name == sym::Vec)
.and_then(|ps| ps.args.as_ref())
.map(|params| params.args.iter().find_map(|arg| match arg {
GenericArg::Type(ty) => Some(ty),
}
}
- if is_type_diagnostic_item(cx, ty, sym!(string_type)) {
+ if is_type_diagnostic_item(cx, ty, sym::string_type) {
if let Some(clone_spans) =
get_spans(cx, Some(body.id()), idx, &[("clone", ".to_string()"), ("as_str", "")]) {
diag.span_suggestion(
/// Functions marked with these attributes must have the exact signature.
fn requires_exact_signature(attrs: &[Attribute]) -> bool {
attrs.iter().any(|attr| {
- [sym!(proc_macro), sym!(proc_macro_attribute), sym!(proc_macro_derive)]
+ [sym::proc_macro, sym::proc_macro_attribute, sym::proc_macro_derive]
.iter()
.any(|&allow| attr.has_name(allow))
})
}
impl<'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt {
- fn consume(&mut self, cmt: &euv::PlaceWithHirId<'tcx>, mode: euv::ConsumeMode) {
+ fn consume(&mut self, cmt: &euv::PlaceWithHirId<'tcx>, _: HirId, mode: euv::ConsumeMode) {
if let euv::ConsumeMode::Move = mode {
self.move_common(cmt);
}
}
- fn borrow(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: ty::BorrowKind) {}
+ fn borrow(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) {}
- fn mutate(&mut self, _: &euv::PlaceWithHirId<'tcx>) {}
+ fn mutate(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId) {}
}