mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 04:55:22 +03:00
Fix lint findings in librustdoc
This commit is contained in:
@@ -634,7 +634,7 @@ fn param_env_to_generics<'b, 'c, 'cx>(
|
||||
// that we don't end up with duplicate bounds (e.g., for<'b, 'b>)
|
||||
for_generics.extend(p.generic_params.clone());
|
||||
p.generic_params = for_generics.into_iter().collect();
|
||||
self.is_fn_ty(&tcx, &p.trait_)
|
||||
self.is_fn_ty(tcx, &p.trait_)
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
@@ -681,7 +681,7 @@ fn param_env_to_generics<'b, 'c, 'cx>(
|
||||
} => {
|
||||
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
|
||||
.entry(*ty.clone())
|
||||
.and_modify(|e| *e = (e.0.clone(), Some(rhs.clone())))
|
||||
@@ -850,7 +850,7 @@ fn unstable_debug_sort<T: Debug>(&self, vec: &mut Vec<T>) {
|
||||
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 {
|
||||
&&Type::ResolvedPath { ref did, .. } => {
|
||||
*did == tcx.require_lang_item(lang_items::FnTraitLangItem)
|
||||
|
||||
@@ -4399,7 +4399,7 @@ pub fn enter_impl_trait<F, R>(cx: &DocContext<'_>, f: F) -> R
|
||||
|
||||
// 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 mut items = krate.module.item_ids.clone();
|
||||
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 krate = crates
|
||||
|
||||
@@ -466,9 +466,9 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
||||
};
|
||||
|
||||
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 {
|
||||
clean::path_to_def(&tcx, &["core", "marker", "Send"])
|
||||
clean::path_to_def(tcx, &["core", "marker", "Send"])
|
||||
};
|
||||
|
||||
let mut renderinfo = RenderInfo::default();
|
||||
|
||||
Reference in New Issue
Block a user