]> git.lizzy.rs Git - rust.git/commitdiff
lib{std,core,debug,rustuv,collections,native,regex}: Fix snake_case errors.
authorKevin Butler <haqkrs@gmail.com>
Mon, 26 May 2014 00:12:43 +0000 (01:12 +0100)
committerKevin Butler <haqkrs@gmail.com>
Fri, 30 May 2014 16:55:41 +0000 (17:55 +0100)
A number of functions/methods have been moved or renamed to align
better with rust standard conventions.

std::reflect::MovePtrAdaptor => MovePtrAdaptor::new
debug::reflect::MovePtrAdaptor => MovePtrAdaptor::new
std::repr::ReprVisitor => ReprVisitor::new
debug::repr::ReprVisitor => ReprVisitor::new
rustuv::homing::HomingIO.go_to_IO_home => go_to_io_home

[breaking-change]

src/libcollections/smallintmap.rs
src/libcore/char.rs
src/libcore/unicode.rs
src/libdebug/reflect.rs
src/libdebug/repr.rs
src/libnative/io/process.rs
src/libregex/test/bench.rs
src/librustuv/homing.rs
src/libstd/reflect.rs
src/libstd/repr.rs

index 8e4e47405e71fe13134998d81ec69aafed448ac4..932011baa56f153c73447dfa40de939c83b64d32 100644 (file)
@@ -296,20 +296,20 @@ fn test_insert_with_key() {
 
         // given a new key, initialize it with this new count,
         // given an existing key, add more to its count
-        fn addMoreToCount(_k: uint, v0: uint, v1: uint) -> uint {
+        fn add_more_to_count(_k: uint, v0: uint, v1: uint) -> uint {
             v0 + v1
         }
 
-        fn addMoreToCount_simple(v0: uint, v1: uint) -> uint {
+        fn add_more_to_count_simple(v0: uint, v1: uint) -> uint {
             v0 + v1
         }
 
         // count integers
-        map.update(3, 1, addMoreToCount_simple);
-        map.update_with_key(9, 1, addMoreToCount);
-        map.update(3, 7, addMoreToCount_simple);
-        map.update_with_key(5, 3, addMoreToCount);
-        map.update_with_key(3, 2, addMoreToCount);
+        map.update(3, 1, add_more_to_count_simple);
+        map.update_with_key(9, 1, add_more_to_count);
+        map.update(3, 7, add_more_to_count_simple);
+        map.update_with_key(5, 3, add_more_to_count);
+        map.update_with_key(3, 2, add_more_to_count);
 
         // check the total counts
         assert_eq!(map.find(&3).unwrap(), &10);
index 2d1cab5d841561b7e62f6c631c5a89d12560a9ad..6b0f0b705612ed22934879a7b8bf15f690f9d85f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -23,6 +23,7 @@
 //! however the converse is not always true due to the above range limits
 //! and, as such, should be performed via the `from_u32` function..
 
+#![allow(non_snake_case_functions)]
 
 use mem::transmute;
 use option::{None, Option, Some};
index 242672de2967aaece1f7a90286d14ec2e02b313a..c6fc5f16ed142afbbaa95c0705fc9be57bf3a644 100644 (file)
@@ -10,7 +10,7 @@
 
 // NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly
 
-#![allow(missing_doc, non_uppercase_statics)]
+#![allow(missing_doc, non_uppercase_statics, non_snake_case_functions)]
 
 
 fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
index 367994466b21e02d632eaf3dd2d20c8de8817012..997d3427122e8daf373b2b6660d231b70147c850 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -42,11 +42,12 @@ pub fn align(size: uint, align: uint) -> uint {
 pub struct MovePtrAdaptor<V> {
     inner: V
 }
-pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
-    MovePtrAdaptor { inner: v }
-}
 
 impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
+    pub fn new(v: V) -> MovePtrAdaptor<V> {
+        MovePtrAdaptor { inner: v }
+    }
+
     #[inline]
     pub fn bump(&mut self, sz: uint) {
         self.inner.move_ptr(|p| ((p as uint) + sz) as *u8)
index 67eee6f2ecf0dd9e76b667e5d0bb34ac68a12c56..e6cc9785b44e72b4576b65028acd769aaaf85e94 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -99,17 +99,6 @@ pub struct ReprVisitor<'a> {
     last_err: Option<io::IoError>,
 }
 
-pub fn ReprVisitor<'a>(ptr: *u8,
-                       writer: &'a mut io::Writer) -> ReprVisitor<'a> {
-    ReprVisitor {
-        ptr: ptr,
-        ptr_stk: vec!(),
-        var_stk: vec!(),
-        writer: writer,
-        last_err: None,
-    }
-}
-
 impl<'a> MovePtr for ReprVisitor<'a> {
     #[inline]
     fn move_ptr(&mut self, adjustment: |*u8| -> *u8) {
@@ -125,6 +114,15 @@ fn pop_ptr(&mut self) {
 
 impl<'a> ReprVisitor<'a> {
     // Various helpers for the TyVisitor impl
+    pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
+        ReprVisitor {
+            ptr: ptr,
+            ptr_stk: vec!(),
+            var_stk: vec!(),
+            writer: writer,
+            last_err: None,
+        }
+    }
 
     #[inline]
     pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
@@ -141,16 +139,8 @@ pub fn visit_inner(&mut self, inner: *TyDesc) -> bool {
     #[inline]
     pub fn visit_ptr_inner(&mut self, ptr: *u8, inner: *TyDesc) -> bool {
         unsafe {
-            // This should call the constructor up above, but due to limiting
-            // issues we have to recreate it here.
-            let u = ReprVisitor {
-                ptr: ptr,
-                ptr_stk: vec!(),
-                var_stk: vec!(),
-                writer: mem::transmute_copy(&self.writer),
-                last_err: None,
-            };
-            let mut v = reflect::MovePtrAdaptor(u);
+            let u = ReprVisitor::new(ptr, mem::transmute_copy(&self.writer));
+            let mut v = reflect::MovePtrAdaptor::new(u);
             // Obviously this should not be a thing, but blame #8401 for now
             visit_tydesc(inner, &mut v as &mut TyVisitor);
             match v.unwrap().last_err {
@@ -584,8 +574,8 @@ pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
     unsafe {
         let ptr = object as *T as *u8;
         let tydesc = get_tydesc::<T>();
-        let u = ReprVisitor(ptr, writer);
-        let mut v = reflect::MovePtrAdaptor(u);
+        let u = ReprVisitor::new(ptr, writer);
+        let mut v = reflect::MovePtrAdaptor::new(u);
         visit_tydesc(tydesc, &mut v as &mut TyVisitor);
         match v.unwrap().last_err {
             Some(e) => Err(e),
index 5bee9489ca9738de588e5e2c00297bfa9d172cac..cddae53fa42f62d6ff4bbae74b0f00adf8d2b3c0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -758,6 +758,7 @@ fn free_handle(_handle: *()) {
 
 #[cfg(unix)]
 fn translate_status(status: c_int) -> p::ProcessExit {
+    #![allow(non_snake_case_functions)]
     #[cfg(target_os = "linux")]
     #[cfg(target_os = "android")]
     mod imp {
index 7c806ece5c85baaea19b060a44eaea5eac875afb..0e4581a401e9056bad45ebe6856a48dfd46aedff 100644 (file)
@@ -7,6 +7,7 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
+#![allow(non_snake_case_functions)]
 
 use std::rand::{Rng, task_rng};
 use std::str;
index b9025397b8d22ea54c2bbea6264c48b1be16217f..5bb9c70f04795b38b8994badb1b3a7fa012dafe3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -88,7 +88,7 @@ pub trait HomingIO {
     /// This function will move tasks to run on their home I/O scheduler. Note
     /// that this function does *not* pin the task to the I/O scheduler, but
     /// rather it simply moves it to running on the I/O scheduler.
-    fn go_to_IO_home(&mut self) -> uint {
+    fn go_to_io_home(&mut self) -> uint {
         let _f = ForbidUnwind::new("going home");
 
         let cur_loop_id = local_id();
@@ -118,7 +118,7 @@ fn go_to_IO_home(&mut self) -> uint {
     /// move the local task to its I/O scheduler and then return an RAII wrapper
     /// which will return the task home.
     fn fire_homing_missile(&mut self) -> HomingMissile {
-        HomingMissile { io_home: self.go_to_IO_home() }
+        HomingMissile { io_home: self.go_to_io_home() }
     }
 }
 
index 02535ccee516f80ac27010197aff36878d72de0c..f21dcdf2a469006afbf91457166dfb79049ab2d0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -42,11 +42,12 @@ pub fn align(size: uint, align: uint) -> uint {
 pub struct MovePtrAdaptor<V> {
     inner: V
 }
-pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
-    MovePtrAdaptor { inner: v }
-}
 
 impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
+    pub fn new(v: V) -> MovePtrAdaptor<V> {
+        MovePtrAdaptor { inner: v }
+    }
+
     #[inline]
     pub fn bump(&mut self, sz: uint) {
         self.inner.move_ptr(|p| ((p as uint) + sz) as *u8)
index 969c20d8b55de221be036aca9d621983d7cf5f17..0621cbf35fe22e78181b2287e2dd41f4caf094c2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -110,17 +110,6 @@ pub struct ReprVisitor<'a> {
     last_err: Option<io::IoError>,
 }
 
-pub fn ReprVisitor<'a>(ptr: *u8,
-                       writer: &'a mut io::Writer) -> ReprVisitor<'a> {
-    ReprVisitor {
-        ptr: ptr,
-        ptr_stk: vec!(),
-        var_stk: vec!(),
-        writer: writer,
-        last_err: None,
-    }
-}
-
 impl<'a> MovePtr for ReprVisitor<'a> {
     #[inline]
     fn move_ptr(&mut self, adjustment: |*u8| -> *u8) {
@@ -136,6 +125,15 @@ fn pop_ptr(&mut self) {
 
 impl<'a> ReprVisitor<'a> {
     // Various helpers for the TyVisitor impl
+    pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
+        ReprVisitor {
+            ptr: ptr,
+            ptr_stk: vec!(),
+            var_stk: vec!(),
+            writer: writer,
+            last_err: None,
+        }
+    }
 
     #[inline]
     pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
@@ -152,16 +150,8 @@ pub fn visit_inner(&mut self, inner: *TyDesc) -> bool {
     #[inline]
     pub fn visit_ptr_inner(&mut self, ptr: *u8, inner: *TyDesc) -> bool {
         unsafe {
-            // This should call the constructor up above, but due to limiting
-            // issues we have to recreate it here.
-            let u = ReprVisitor {
-                ptr: ptr,
-                ptr_stk: vec!(),
-                var_stk: vec!(),
-                writer: ::mem::transmute_copy(&self.writer),
-                last_err: None,
-            };
-            let mut v = reflect::MovePtrAdaptor(u);
+            let u = ReprVisitor::new(ptr, ::mem::transmute_copy(&self.writer));
+            let mut v = reflect::MovePtrAdaptor::new(u);
             // Obviously this should not be a thing, but blame #8401 for now
             visit_tydesc(inner, &mut v as &mut TyVisitor);
             match v.unwrap().last_err {
@@ -592,8 +582,8 @@ pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
     unsafe {
         let ptr = object as *T as *u8;
         let tydesc = get_tydesc::<T>();
-        let u = ReprVisitor(ptr, writer);
-        let mut v = reflect::MovePtrAdaptor(u);
+        let u = ReprVisitor::new(ptr, writer);
+        let mut v = reflect::MovePtrAdaptor::new(u);
         visit_tydesc(tydesc, &mut v as &mut TyVisitor);
         match v.unwrap().last_err {
             Some(e) => Err(e),