core: Remove bool::to_bit

This is an unused one-liner.
This commit is contained in:
Brian Anderson 2014-06-23 22:58:01 +00:00 committed by Alex Crichton
parent adbd5d7a42
commit 4203dcb351
1 changed files with 1 additions and 24 deletions

View File

@ -8,33 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Operations on boolean values (`bool` type)
//!
//! A `to_bit` conversion function.
//! The boolean type
#![doc(primitive = "bool")]
use num::{Int, one, zero};
/////////////////////////////////////////////////////////////////////////////
// Freestanding functions
/////////////////////////////////////////////////////////////////////////////
/// Convert a `bool` to an integer.
///
/// # Examples
///
/// ```rust
/// use std::bool;
///
/// assert_eq!(bool::to_bit::<u8>(true), 1u8);
/// assert_eq!(bool::to_bit::<u8>(false), 0u8);
/// ```
#[inline]
pub fn to_bit<N: Int>(p: bool) -> N {
if p { one() } else { zero() }
}
#[cfg(test)]
mod tests {
use realstd::prelude::*;