From d820355213d433c85ef49bae03022d754ca2f5d5 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 29 Jun 2013 02:43:51 -0400 Subject: [PATCH 1/3] fix code block syntax in two docstrings --- src/libstd/iterator.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs index 976ca8bae7a87..55eae8f8fae18 100644 --- a/src/libstd/iterator.rs +++ b/src/libstd/iterator.rs @@ -356,20 +356,20 @@ pub trait IteratorUtil { /// /// # Example /// - /// --- {.rust} + /// ~~~ {.rust} /// let xs = [-3, 0, 1, 5, -10]; /// assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10); - /// --- + /// ~~~ fn max_by(&mut self, f: &fn(&A) -> B) -> Option; /// Return the element that gives the minimum value from the specfied function /// /// # Example /// - /// --- {.rust} + /// ~~~ {.rust} /// let xs = [-3, 0, 1, 5, -10]; /// assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0); - /// --- + /// ~~~ fn min_by(&mut self, f: &fn(&A) -> B) -> Option; } From eee7accedb4b529dac67b2a50c4e25e3f47777d8 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 28 Jun 2013 20:34:06 +0200 Subject: [PATCH 2/3] Add -v/--version support to rust binary --- src/librust/rust.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librust/rust.rs b/src/librust/rust.rs index ba5e592b605c3..6542afe678b1a 100644 --- a/src/librust/rust.rs +++ b/src/librust/rust.rs @@ -238,6 +238,12 @@ fn usage() { pub fn main() { let os_args = os::args(); + + if (os_args.len() > 1 && (os_args[1] == ~"-v" || os_args[1] == ~"--version")) { + rustc::version(os_args[0]); + unsafe { exit(0); } + } + let args = os_args.tail(); if !args.is_empty() { From 052f28a8083c624a8f0a892893f9a059906e15c5 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 28 Jun 2013 23:44:55 -0400 Subject: [PATCH 3/3] minor vec cleanup * hide the rustrt module in the docs * remove the useless `traits` module wrapping the `Add` impl --- src/libstd/vec.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 4196fbac0beb5..cff4ac10145c7 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -23,6 +23,7 @@ use iter::FromIter; use kinds::Copy; use libc; use num::Zero; +use ops::Add; use option::{None, Option, Some}; use ptr::to_unsafe_ptr; use ptr; @@ -40,6 +41,7 @@ use util; #[cfg(not(test))] use cmp::Equiv; +#[doc(hidden)] pub mod rustrt { use libc; use vec::raw; @@ -1180,16 +1182,10 @@ impl Ord for @[T] { } #[cfg(not(test))] -pub mod traits { - use kinds::Copy; - use ops::Add; - use vec::append; - - impl<'self,T:Copy> Add<&'self [T],~[T]> for ~[T] { - #[inline] - fn add(&self, rhs: & &'self [T]) -> ~[T] { - append(copy *self, (*rhs)) - } +impl<'self,T:Copy> Add<&'self [T], ~[T]> for ~[T] { + #[inline] + fn add(&self, rhs: & &'self [T]) -> ~[T] { + append(copy *self, (*rhs)) } }