]> git.lizzy.rs Git - rust.git/commitdiff
librustc: use tuple indexing
authorJorge Aparicio <japaricious@gmail.com>
Tue, 9 Dec 2014 17:21:18 +0000 (12:21 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sun, 14 Dec 2014 01:04:41 +0000 (20:04 -0500)
src/librustc/lint/context.rs
src/librustc/metadata/loader.rs
src/librustc/middle/check_match.rs
src/librustc_borrowck/graphviz.rs

index 9f9e266c6c74b2ea0602799a4dea007398d758c5..75f2fc81900c463df82d7255eb56dee405ad2a61 100644 (file)
@@ -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)));
index e364bd8e752d5bad7d7d35a7766b9faf0e0ef8a6..e83f69b1e318ee5725281202557319ceaebfc930 100644 (file)
@@ -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
index ea3ef2af7390612b46020116e5f4d6020b0a959e..669f4ee6ec81c4c030c05caec66952c2421216dd 100644 (file)
@@ -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);
index e09ec79166997db26327b351cd191649ca01763b..9d41efd678c7cd47e03590be7fe3868751a9defb 100644 (file)
@@ -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),