parent
07c2e61436
commit
76321d3300
52 changed files with 61 additions and 61 deletions
|
|
@ -5,14 +5,14 @@
|
|||
use lazy_static::lazy_static;
|
||||
use std::{env, fmt, fs, io, path};
|
||||
use std::io::Read;
|
||||
use syntax::{ast, codemap};
|
||||
use syntax::{ast, source_map};
|
||||
use toml;
|
||||
use std::sync::Mutex;
|
||||
|
||||
/// Get the configuration file from arguments.
|
||||
pub fn file_from_args(
|
||||
args: &[codemap::Spanned<ast::NestedMetaItemKind>],
|
||||
) -> Result<Option<path::PathBuf>, (&'static str, codemap::Span)> {
|
||||
args: &[source_map::Spanned<ast::NestedMetaItemKind>],
|
||||
) -> Result<Option<path::PathBuf>, (&'static str, source_map::Span)> {
|
||||
for arg in args.iter().filter_map(|a| a.meta_item()) {
|
||||
if arg.name() == "conf_file" {
|
||||
return match arg.node {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use crate::utils::{match_qpath, paths, span_lint, span_lint_and_sugg};
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use syntax::ast::{Crate as AstCrate, Ident, ItemKind, Name};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use std::str::FromStr;
|
|||
use std::rc::Rc;
|
||||
use syntax::ast::{self, LitKind};
|
||||
use syntax::attr;
|
||||
use syntax::codemap::{Span, DUMMY_SP};
|
||||
use syntax::source_map::{Span, DUMMY_SP};
|
||||
use syntax::errors::DiagnosticBuilder;
|
||||
use syntax::ptr::P;
|
||||
use syntax::symbol::keywords;
|
||||
|
|
@ -365,7 +365,7 @@ pub fn snippet<'a, 'b, T: LintContext<'b>>(cx: &T, span: Span, default: &'a str)
|
|||
|
||||
/// Convert a span to a code snippet. Returns `None` if not available.
|
||||
pub fn snippet_opt<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Option<String> {
|
||||
cx.sess().codemap().span_to_snippet(span).ok()
|
||||
cx.sess().source_map().span_to_snippet(span).ok()
|
||||
}
|
||||
|
||||
/// Convert a span (from a block) to a code snippet if available, otherwise use
|
||||
|
|
@ -385,7 +385,7 @@ pub fn snippet_block<'a, 'b, T: LintContext<'b>>(cx: &T, span: Span, default: &'
|
|||
|
||||
/// Returns a new Span that covers the full last line of the given Span
|
||||
pub fn last_line_of_span<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Span {
|
||||
let file_map_and_line = cx.sess().codemap().lookup_line(span.lo()).unwrap();
|
||||
let file_map_and_line = cx.sess().source_map().lookup_line(span.lo()).unwrap();
|
||||
let line_no = file_map_and_line.line;
|
||||
let line_start = &file_map_and_line.fm.lines[line_no];
|
||||
Span::new(*line_start, span.hi(), span.ctxt())
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use rustc::hir::*;
|
|||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc::lint::LateContext;
|
||||
use syntax::ast::Name;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
use crate::utils::{get_pat_name, match_var, snippet};
|
||||
|
||||
pub fn get_spans(
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use rustc_errors;
|
|||
use std::borrow::Cow;
|
||||
use std::fmt::Display;
|
||||
use std;
|
||||
use syntax::codemap::{CharPos, Span};
|
||||
use syntax::source_map::{CharPos, Span};
|
||||
use syntax::parse::token;
|
||||
use syntax::print::pprust::token_to_string;
|
||||
use syntax::util::parser::AssocOp;
|
||||
|
|
@ -432,7 +432,7 @@ fn astbinop2assignop(op: ast::BinOp) -> AssocOp {
|
|||
/// Return the indentation before `span` if there are nothing but `[ \t]`
|
||||
/// before it on its line.
|
||||
fn indentation<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Option<String> {
|
||||
let lo = cx.sess().codemap().lookup_char_pos(span.lo());
|
||||
let lo = cx.sess().source_map().lookup_char_pos(span.lo());
|
||||
if let Some(line) = lo.file
|
||||
.get_line(lo.line - 1 /* line numbers in `Loc` are 1-based */)
|
||||
{
|
||||
|
|
@ -524,8 +524,8 @@ impl<'a, 'b, 'c, T: LintContext<'c>> DiagnosticBuilderExt<'c, T> for rustc_error
|
|||
|
||||
fn suggest_remove_item(&mut self, cx: &T, item: Span, msg: &str) {
|
||||
let mut remove_span = item;
|
||||
let hi = cx.sess().codemap().next_point(remove_span).hi();
|
||||
let fmpos = cx.sess().codemap().lookup_byte_offset(hi);
|
||||
let hi = cx.sess().source_map().next_point(remove_span).hi();
|
||||
let fmpos = cx.sess().source_map().lookup_byte_offset(hi);
|
||||
|
||||
if let Some(ref src) = fmpos.fm.src {
|
||||
let non_whitespace_offset = src[fmpos.pos.to_usize()..].find(|c| c != ' ' && c != '\t' && c != '\n');
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use rustc::middle::mem_categorization::Categorization;
|
|||
use rustc::ty;
|
||||
use std::collections::HashSet;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// Returns a set of mutated local variable ids or None if mutations could not be determined.
|
||||
pub fn mutated_variables<'a, 'tcx: 'a>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option<HashSet<NodeId>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue