cargo fmt
This commit is contained in:
@@ -10,9 +10,9 @@ use rustc::hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisito
|
|||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||||
use rustc::ty::layout::LayoutOf;
|
use rustc::ty::layout::LayoutOf;
|
||||||
|
use rustc::ty::print::Printer;
|
||||||
use rustc::ty::{self, InferTy, Ty, TyCtxt, TypeckTables};
|
use rustc::ty::{self, InferTy, Ty, TyCtxt, TypeckTables};
|
||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use rustc::ty::print::Printer;
|
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_target::spec::abi::Abi;
|
use rustc_target::spec::abi::Abi;
|
||||||
use rustc_typeck::hir_ty_to_ty;
|
use rustc_typeck::hir_ty_to_ty;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use rustc::hir::intravisit::{walk_item, walk_path, walk_ty, NestedVisitorMap, Vi
|
|||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||||
use rustc::ty;
|
use rustc::ty;
|
||||||
use rustc::{declare_tool_lint, lint_array};
|
|
||||||
use rustc::ty::DefIdTree;
|
use rustc::ty::DefIdTree;
|
||||||
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use syntax_pos::symbol::keywords::SelfUpper;
|
use syntax_pos::symbol::keywords::SelfUpper;
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ use if_chain::if_chain;
|
|||||||
use matches::matches;
|
use matches::matches;
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::def::Def;
|
use rustc::hir::def::Def;
|
||||||
use rustc::hir::map::DisambiguatedDefPathData;
|
|
||||||
use rustc::hir::def_id::CrateNum;
|
use rustc::hir::def_id::CrateNum;
|
||||||
use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||||
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
||||||
|
use rustc::hir::map::DisambiguatedDefPathData;
|
||||||
use rustc::hir::Node;
|
use rustc::hir::Node;
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
use rustc::lint::{LateContext, Level, Lint, LintContext};
|
use rustc::lint::{LateContext, Level, Lint, LintContext};
|
||||||
@@ -43,7 +43,7 @@ use rustc_errors::Applicability;
|
|||||||
use syntax::ast::{self, LitKind};
|
use syntax::ast::{self, LitKind};
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::source_map::{Span, DUMMY_SP};
|
use syntax::source_map::{Span, DUMMY_SP};
|
||||||
use syntax::symbol::{keywords, Symbol, LocalInternedString};
|
use syntax::symbol::{keywords, LocalInternedString, Symbol};
|
||||||
|
|
||||||
use crate::reexport::*;
|
use crate::reexport::*;
|
||||||
|
|
||||||
@@ -116,17 +116,11 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> {
|
|||||||
self.tcx
|
self.tcx
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_region(
|
fn print_region(self, _region: ty::Region<'_>) -> Result<Self::Region, Self::Error> {
|
||||||
self,
|
|
||||||
_region: ty::Region<'_>,
|
|
||||||
) -> Result<Self::Region, Self::Error> {
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_type(
|
fn print_type(self, _ty: Ty<'tcx>) -> Result<Self::Type, Self::Error> {
|
||||||
self,
|
|
||||||
_ty: Ty<'tcx>,
|
|
||||||
) -> Result<Self::Type, Self::Error> {
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,10 +131,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn path_crate(
|
fn path_crate(self, cnum: CrateNum) -> Result<Self::Path, Self::Error> {
|
||||||
self,
|
|
||||||
cnum: CrateNum,
|
|
||||||
) -> Result<Self::Path, Self::Error> {
|
|
||||||
Ok(vec![self.tcx.original_crate_name(cnum).as_str()])
|
Ok(vec![self.tcx.original_crate_name(cnum).as_str()])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,9 +158,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> {
|
|||||||
|
|
||||||
// This shouldn't ever be needed, but just in case:
|
// This shouldn't ever be needed, but just in case:
|
||||||
path.push(match trait_ref {
|
path.push(match trait_ref {
|
||||||
Some(trait_ref) => {
|
Some(trait_ref) => Symbol::intern(&format!("<impl {} for {}>", trait_ref, self_ty)).as_str(),
|
||||||
Symbol::intern(&format!("<impl {} for {}>", trait_ref, self_ty)).as_str()
|
|
||||||
}
|
|
||||||
None => Symbol::intern(&format!("<impl {}>", self_ty)).as_str(),
|
None => Symbol::intern(&format!("<impl {}>", self_ty)).as_str(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -219,7 +208,12 @@ pub fn match_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, path
|
|||||||
/// };
|
/// };
|
||||||
/// ```
|
/// ```
|
||||||
pub fn get_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Vec<&'static str> {
|
pub fn get_def_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Vec<&'static str> {
|
||||||
AbsolutePathPrinter { tcx }.print_def_path(def_id, &[]).unwrap().iter().map(LocalInternedString::get).collect()
|
AbsolutePathPrinter { tcx }
|
||||||
|
.print_def_path(def_id, &[])
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.map(LocalInternedString::get)
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if type is struct, enum or union type with the given def path.
|
/// Checks if type is struct, enum or union type with the given def path.
|
||||||
|
|||||||
Reference in New Issue
Block a user