pacify the mercilous tidy

This commit is contained in:
Niko Matsakis 2018-05-22 11:45:36 -04:00
parent 60c4eb4566
commit 9f117144f6
2 changed files with 29 additions and 5 deletions

View File

@ -1660,7 +1660,13 @@ impl<'a> Resolver<'a> {
PathResult::Module(module) => *def = module.def().unwrap(),
PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 =>
*def = path_res.base_def(),
PathResult::NonModule(..) => match self.resolve_path(&path, None, true, span, CrateLint::No) {
PathResult::NonModule(..) => match self.resolve_path(
&path,
None,
true,
span,
CrateLint::No,
) {
PathResult::Failed(span, msg, _) => {
error_callback(self, span, ResolutionError::FailedToResolve(&msg));
}
@ -3175,7 +3181,13 @@ impl<'a> Resolver<'a> {
));
}
let result = match self.resolve_path(&path, Some(ns), true, span, CrateLint::SimplePath(id)) {
let result = match self.resolve_path(
&path,
Some(ns),
true,
span,
CrateLint::SimplePath(id),
) {
PathResult::NonModule(path_res) => path_res,
PathResult::Module(module) if !module.is_normal() => {
PathResolution::new(module.def().unwrap())
@ -3212,7 +3224,13 @@ impl<'a> Resolver<'a> {
path[0].name != keywords::CrateRoot.name() &&
path[0].name != keywords::DollarCrate.name() {
let unqualified_result = {
match self.resolve_path(&[*path.last().unwrap()], Some(ns), false, span, CrateLint::No) {
match self.resolve_path(
&[*path.last().unwrap()],
Some(ns),
false,
span,
CrateLint::No,
) {
PathResult::NonModule(path_res) => path_res.base_def(),
PathResult::Module(module) => module.def().unwrap(),
_ => return Some(result),

View File

@ -60,7 +60,7 @@ pub struct ImportDirective<'a> {
/// In the case where the `ImportDirective` was expanded from a "nested" use tree,
/// this id is the id of the leaf tree. For example:
///
/// ```rust,ignore
/// ```ignore (pacify the mercilous tidy)
/// use foo::bar::{a, b}
/// ```
///
@ -737,7 +737,13 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
}
}
let module_result = self.resolve_path(&module_path, None, true, span, directive.crate_lint());
let module_result = self.resolve_path(
&module_path,
None,
true,
span,
directive.crate_lint(),
);
let module = match module_result {
PathResult::Module(module) => module,
PathResult::Failed(span, msg, false) => {