Use DUMMY_SP in multiple_crate_versions

This commit is contained in:
Hidehito Yabuuchi 2018-10-24 20:22:38 +09:00
parent 663f2cff7e
commit 0d577c36a9
2 changed files with 4 additions and 11 deletions

View File

@ -7,12 +7,11 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
//! lint on multiple versions of a crate being used //! lint on multiple versions of a crate being used
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::{declare_tool_lint, lint_array};
use crate::syntax::ast::*; use crate::syntax::{ast::*, source_map::DUMMY_SP};
use crate::utils::span_lint; use crate::utils::span_lint;
use cargo_metadata; use cargo_metadata;
@ -54,12 +53,7 @@ impl EarlyLintPass for Pass {
let metadata = if let Ok(metadata) = cargo_metadata::metadata_deps(None, true) { let metadata = if let Ok(metadata) = cargo_metadata::metadata_deps(None, true) {
metadata metadata
} else { } else {
span_lint( span_lint(cx, MULTIPLE_CRATE_VERSIONS, krate.span, "could not read cargo metadata");
cx,
MULTIPLE_CRATE_VERSIONS,
krate.span,
"could not read cargo metadata"
);
return; return;
}; };
@ -76,7 +70,7 @@ impl EarlyLintPass for Pass {
span_lint( span_lint(
cx, cx,
MULTIPLE_CRATE_VERSIONS, MULTIPLE_CRATE_VERSIONS,
krate.span, DUMMY_SP,
&format!("multiple versions for dependency `{}`: {}", name, versions), &format!("multiple versions for dependency `{}`: {}", name, versions),
); );
} }

View File

@ -9,8 +9,7 @@
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc::{declare_tool_lint, lint_array};
use crate::syntax::ast::*; use crate::syntax::{ast::*, source_map::DUMMY_SP};
use crate::syntax::source_map::DUMMY_SP;
use crate::utils::span_lint; use crate::utils::span_lint;
use cargo_metadata; use cargo_metadata;