Skip to content

Commit

Permalink
pacify the mercilous tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed May 22, 2018
1 parent 60c4eb4 commit 9f11714
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
24 changes: 21 additions & 3 deletions src/librustc_resolve/lib.rs
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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),
Expand Down
10 changes: 8 additions & 2 deletions src/librustc_resolve/resolve_imports.rs
Expand Up @@ -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}
/// ```
///
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 9f11714

Please sign in to comment.