librustc: use tuple indexing
This commit is contained in:
parent
c434954b27
commit
821b836634
src
@ -34,7 +34,6 @@ use lint::builtin;
|
||||
use util::nodemap::FnvHashMap;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::tuple::Tuple2;
|
||||
use std::mem;
|
||||
use syntax::ast_util::IdVisitingOperation;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
@ -87,7 +86,7 @@ impl LintStore {
|
||||
}
|
||||
|
||||
fn set_level(&mut self, lint: LintId, lvlsrc: LevelSource) {
|
||||
if lvlsrc.val0() == Allow {
|
||||
if lvlsrc.0 == Allow {
|
||||
self.levels.remove(&lint);
|
||||
} else {
|
||||
self.levels.insert(lint, lvlsrc);
|
||||
@ -110,8 +109,8 @@ impl LintStore {
|
||||
|
||||
pub fn get_lint_groups<'t>(&'t self) -> Vec<(&'static str, Vec<LintId>, bool)> {
|
||||
self.lint_groups.iter().map(|(k, v)| (*k,
|
||||
v.ref0().clone(),
|
||||
*v.ref1())).collect()
|
||||
v.0.clone(),
|
||||
v.1)).collect()
|
||||
}
|
||||
|
||||
pub fn register_pass(&mut self, sess: Option<&Session>,
|
||||
@ -275,7 +274,7 @@ impl LintStore {
|
||||
match self.find_lint(lint_name.as_slice(), sess, None) {
|
||||
Some(lint_id) => self.set_level(lint_id, (level, CommandLine)),
|
||||
None => {
|
||||
match self.lint_groups.iter().map(|(&x, pair)| (x, pair.ref0().clone()))
|
||||
match self.lint_groups.iter().map(|(&x, pair)| (x, pair.0.clone()))
|
||||
.collect::<FnvHashMap<&'static str,
|
||||
Vec<LintId>>>()
|
||||
.get(lint_name.as_slice()) {
|
||||
@ -443,7 +442,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
|
||||
None => return,
|
||||
Some(&(Warn, src)) => {
|
||||
let lint_id = LintId::of(builtin::WARNINGS);
|
||||
(self.lints.get_level_source(lint_id).val0(), src)
|
||||
(self.lints.get_level_source(lint_id).0, src)
|
||||
}
|
||||
Some(&pair) => pair,
|
||||
};
|
||||
@ -503,7 +502,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
|
||||
};
|
||||
|
||||
for (lint_id, level, span) in v.into_iter() {
|
||||
let now = self.lints.get_level_source(lint_id).val0();
|
||||
let now = self.lints.get_level_source(lint_id).0;
|
||||
if now == Forbid && level != Forbid {
|
||||
let lint_name = lint_id.as_str();
|
||||
self.tcx.sess.span_err(span,
|
||||
@ -511,7 +510,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
|
||||
level.as_str(), lint_name,
|
||||
lint_name).as_slice());
|
||||
} else if now != level {
|
||||
let src = self.lints.get_level_source(lint_id).val1();
|
||||
let src = self.lints.get_level_source(lint_id).1;
|
||||
self.level_stack.push((lint_id, (now, src)));
|
||||
pushed += 1;
|
||||
self.lints.set_level(lint_id, (level, Node(span)));
|
||||
|
@ -364,7 +364,7 @@ impl<'a> Context<'a> {
|
||||
let dypair = self.dylibname();
|
||||
|
||||
// want: crate_name.dir_part() + prefix + crate_name.file_part + "-"
|
||||
let dylib_prefix = format!("{}{}", dypair.ref0(), self.crate_name);
|
||||
let dylib_prefix = format!("{}{}", dypair.0, self.crate_name);
|
||||
let rlib_prefix = format!("lib{}", self.crate_name);
|
||||
|
||||
let mut candidates = HashMap::new();
|
||||
@ -392,8 +392,8 @@ impl<'a> Context<'a> {
|
||||
(file.slice(rlib_prefix.len(), file.len() - ".rlib".len()),
|
||||
true)
|
||||
} else if file.starts_with(dylib_prefix.as_slice()) &&
|
||||
file.ends_with(dypair.ref1().as_slice()) {
|
||||
(file.slice(dylib_prefix.len(), file.len() - dypair.ref1().len()),
|
||||
file.ends_with(dypair.1.as_slice()) {
|
||||
(file.slice(dylib_prefix.len(), file.len() - dypair.1.len()),
|
||||
false)
|
||||
} else {
|
||||
return FileDoesntMatch
|
||||
|
@ -220,7 +220,7 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &ast::Expr) {
|
||||
let matrix: Matrix = inlined_arms
|
||||
.iter()
|
||||
.filter(|&&(_, guard)| guard.is_none())
|
||||
.flat_map(|arm| arm.ref0().iter())
|
||||
.flat_map(|arm| arm.0.iter())
|
||||
.map(|pat| vec![&**pat])
|
||||
.collect();
|
||||
check_exhaustive(cx, ex.span, &matrix);
|
||||
|
@ -53,7 +53,7 @@ pub struct DataflowLabeller<'a, 'tcx: 'a> {
|
||||
|
||||
impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
||||
fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String {
|
||||
let id = n.val1().data.id;
|
||||
let id = n.1.data.id;
|
||||
debug!("dataflow_for({}, id={}) {}", e, id, self.variants);
|
||||
let mut sets = "".to_string();
|
||||
let mut seen_one = false;
|
||||
@ -67,7 +67,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn dataflow_for_variant(&self, e: EntryOrExit, n: &Node, v: Variant) -> String {
|
||||
let cfgidx = n.val0();
|
||||
let cfgidx = n.0;
|
||||
match v {
|
||||
Loans => self.dataflow_loans_for(e, cfgidx),
|
||||
Moves => self.dataflow_moves_for(e, cfgidx),
|
||||
|
Loading…
x
Reference in New Issue
Block a user