Fix lint findings in librustdoc

This commit is contained in:
flip1995 2019-04-27 18:37:18 +02:00
parent e1da67e69c
commit 86ed3116ba
No known key found for this signature in database
GPG key ID: 693086869D506637
3 changed files with 7 additions and 7 deletions

View file

@ -634,7 +634,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
// that we don't end up with duplicate bounds (e.g., for<'b, 'b>) // that we don't end up with duplicate bounds (e.g., for<'b, 'b>)
for_generics.extend(p.generic_params.clone()); for_generics.extend(p.generic_params.clone());
p.generic_params = for_generics.into_iter().collect(); p.generic_params = for_generics.into_iter().collect();
self.is_fn_ty(&tcx, &p.trait_) self.is_fn_ty(tcx, &p.trait_)
} }
_ => false, _ => false,
}; };
@ -681,7 +681,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
} => { } => {
let mut new_trait_path = trait_path.clone(); let mut new_trait_path = trait_path.clone();
if self.is_fn_ty(&tcx, trait_) && left_name == FN_OUTPUT_NAME { if self.is_fn_ty(tcx, trait_) && left_name == FN_OUTPUT_NAME {
ty_to_fn ty_to_fn
.entry(*ty.clone()) .entry(*ty.clone())
.and_modify(|e| *e = (e.0.clone(), Some(rhs.clone()))) .and_modify(|e| *e = (e.0.clone(), Some(rhs.clone())))
@ -850,7 +850,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
vec.sort_by_cached_key(|x| format!("{:?}", x)) vec.sort_by_cached_key(|x| format!("{:?}", x))
} }
fn is_fn_ty(&self, tcx: &TyCtxt<'_, '_, '_>, ty: &Type) -> bool { fn is_fn_ty(&self, tcx: TyCtxt<'_, '_, '_>, ty: &Type) -> bool {
match &ty { match &ty {
&&Type::ResolvedPath { ref did, .. } => { &&Type::ResolvedPath { ref did, .. } => {
*did == tcx.require_lang_item(lang_items::FnTraitLangItem) *did == tcx.require_lang_item(lang_items::FnTraitLangItem)

View file

@ -4399,7 +4399,7 @@ where
// Start of code copied from rust-clippy // Start of code copied from rust-clippy
pub fn path_to_def_local(tcx: &TyCtxt<'_, '_, '_>, path: &[&str]) -> Option<DefId> { pub fn path_to_def_local(tcx: TyCtxt<'_, '_, '_>, path: &[&str]) -> Option<DefId> {
let krate = tcx.hir().krate(); let krate = tcx.hir().krate();
let mut items = krate.module.item_ids.clone(); let mut items = krate.module.item_ids.clone();
let mut path_it = path.iter().peekable(); let mut path_it = path.iter().peekable();
@ -4424,7 +4424,7 @@ pub fn path_to_def_local(tcx: &TyCtxt<'_, '_, '_>, path: &[&str]) -> Option<DefI
} }
} }
pub fn path_to_def(tcx: &TyCtxt<'_, '_, '_>, path: &[&str]) -> Option<DefId> { pub fn path_to_def(tcx: TyCtxt<'_, '_, '_>, path: &[&str]) -> Option<DefId> {
let crates = tcx.crates(); let crates = tcx.crates();
let krate = crates let krate = crates

View file

@ -466,9 +466,9 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
}; };
let send_trait = if crate_name == Some("core".to_string()) { let send_trait = if crate_name == Some("core".to_string()) {
clean::path_to_def_local(&tcx, &["marker", "Send"]) clean::path_to_def_local(tcx, &["marker", "Send"])
} else { } else {
clean::path_to_def(&tcx, &["core", "marker", "Send"]) clean::path_to_def(tcx, &["core", "marker", "Send"])
}; };
let mut renderinfo = RenderInfo::default(); let mut renderinfo = RenderInfo::default();