提交 821b8366 编写于 作者: J Jorge Aparicio

librustc: use tuple indexing

上级 c434954b
......@@ -34,7 +34,6 @@
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 @@ fn get_level_source(&self, lint: LintId) -> LevelSource {
}
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 @@ pub fn get_lints<'t>(&'t self) -> &'t [(&'static Lint, bool)] {
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 @@ pub fn process_command_line(&mut self, sess: &Session) {
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 @@ fn lookup_and_emit(&self, lint: &'static Lint, span: Option<Span>, msg: &str) {
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 @@ fn with_lint_attrs<F>(&mut self,
};
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 @@ fn with_lint_attrs<F>(&mut self,
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 @@ fn find_library_crate(&mut self) -> Option<Library> {
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 @@ fn find_library_crate(&mut self) -> Option<Library> {
(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 @@ fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String {
}
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),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册