Skip to content

Minor doc fixes in various places #14291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -2943,7 +2943,7 @@ See [Break expressions](#break-expressions) and [Continue expressions](#continue
break_expr : "break" [ lifetime ];
~~~~

A `break` expression has an optional `label`.
A `break` expression has an optional _label_.
If the label is absent, then executing a `break` expression immediately terminates the innermost loop enclosing it.
It is only permitted in the body of a loop.
If the label is present, then `break foo` terminates the loop with label `foo`,
Expand All @@ -2956,7 +2956,7 @@ but must enclose it.
continue_expr : "continue" [ lifetime ];
~~~~

A `continue` expression has an optional `label`.
A `continue` expression has an optional _label_.
If the label is absent,
then executing a `continue` expression immediately terminates the current iteration of the innermost loop enclosing it,
returning control to the loop *head*.
Expand Down Expand Up @@ -3115,7 +3115,7 @@ let x: List<int> = Cons(10, box Cons(11, box Nil));

match x {
Cons(a, box Cons(b, _)) => {
process_pair(a,b);
process_pair(a, b);
}
Cons(10, _) => {
process_ten();
Expand Down Expand Up @@ -3329,8 +3329,8 @@ order specified by the tuple type.
An example of a tuple type and its use:

~~~~
type Pair<'a> = (int,&'a str);
let p: Pair<'static> = (10,"hello");
type Pair<'a> = (int, &'a str);
let p: Pair<'static> = (10, "hello");
let (a, b) = p;
assert!(b != "world");
~~~~
Expand Down
2 changes: 1 addition & 1 deletion src/doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -2602,7 +2602,7 @@ fn main() {
~~~

The full list of derivable traits is `Eq`, `TotalEq`, `Ord`,
`TotalOrd`, `Encodable` `Decodable`, `Clone`,
`TotalOrd`, `Encodable`, `Decodable`, `Clone`,
`Hash`, `Rand`, `Default`, `Zero`, `FromPrimitive` and `Show`.

# Crates and the module system
Expand Down
5 changes: 4 additions & 1 deletion src/libcore/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
//! Implementations of the following traits:
//!
//! * `Not`
//! * `BitAnd`
//! * `BitOr`
//! * `BitXor`
//! * `Ord`
//! * `TotalOrd`
//! * `Eq`
//! * `TotalEq`
//! * `Default`
//! * `Zero`
//!
//! A `to_bit` conversion function.

Expand Down
38 changes: 21 additions & 17 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! Numeric traits and functions for generic mathematics
//!
//! These are implemented for the primitive numeric types in `std::{u8, u16,
//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64, float}`.
//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`.

#![allow(missing_doc)]

Expand Down Expand Up @@ -97,7 +97,7 @@ pub trait One: Mul<Self, Self> {
pub trait Signed: Num + Neg<Self> {
/// Computes the absolute value.
///
/// For float, f32, and f64, `NaN` will be returned if the number is `NaN`.
/// For `f32` and `f64`, `NaN` will be returned if the number is `NaN`.
fn abs(&self) -> Self;

/// The positive difference of two numbers.
Expand All @@ -108,15 +108,17 @@ pub trait Signed: Num + Neg<Self> {

/// Returns the sign of the number.
///
/// For `float`, `f32`, `f64`:
/// * `1.0` if the number is positive, `+0.0` or `INFINITY`
/// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
/// * `NaN` if the number is `NaN`
/// For `f32` and `f64`:
///
/// * `1.0` if the number is positive, `+0.0` or `INFINITY`
/// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
/// * `NaN` if the number is `NaN`
///
/// For `int`:
/// * `0` if the number is zero
/// * `1` if the number is positive
/// * `-1` if the number is negative
///
/// * `0` if the number is zero
/// * `1` if the number is positive
/// * `-1` if the number is negative
fn signum(&self) -> Self;

/// Returns true if the number is positive and false if the number is zero or negative.
Expand All @@ -128,7 +130,7 @@ pub trait Signed: Num + Neg<Self> {

/// Computes the absolute value.
///
/// For float, f32, and f64, `NaN` will be returned if the number is `NaN`
/// For `f32` and `f64`, `NaN` will be returned if the number is `NaN`
#[inline(always)]
pub fn abs<T: Signed>(value: T) -> T {
value.abs()
Expand All @@ -145,15 +147,17 @@ pub fn abs_sub<T: Signed>(x: T, y: T) -> T {

/// Returns the sign of the number.
///
/// For float, f32, f64:
/// - `1.0` if the number is positive, `+0.0` or `INFINITY`
/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
/// - `NAN` if the number is `NAN`
/// For `f32` and `f64`:
///
/// * `1.0` if the number is positive, `+0.0` or `INFINITY`
/// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
/// * `NaN` if the number is `NaN`
///
/// For int:
/// - `0` if the number is zero
/// - `1` if the number is positive
/// - `-1` if the number is negative
///
/// * `0` if the number is zero
/// * `1` if the number is positive
/// * `-1` if the number is negative
#[inline(always)] pub fn signum<T: Signed>(value: T) -> T { value.signum() }

/// A trait for values which cannot be negative
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! Numeric traits and functions for generic mathematics
//!
//! These are implemented for the primitive numeric types in `std::{u8, u16,
//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64, float}`.
//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`.

#![allow(missing_doc)]

Expand Down