Merge pull request #132 from rust-lang-nursery/align

Clean up excessive indentation
This commit is contained in:
David Tolnay 2017-10-22 14:54:45 -07:00 committed by GitHub
commit 8e163c64ec
7 changed files with 46 additions and 54 deletions

View File

@ -6,11 +6,9 @@ bitflags! {
/// Note that this struct is just for documentation purposes only, it must not be used outside
/// this crate.
pub struct Flags: u32 {
const FLAG_A = 0b00000001;
const FLAG_B = 0b00000010;
const FLAG_C = 0b00000100;
const FLAG_ABC = Self::FLAG_A.bits
| Self::FLAG_B.bits
| Self::FLAG_C.bits;
const FLAG_A = 0b00000001;
const FLAG_B = 0b00000010;
const FLAG_C = 0b00000100;
const FLAG_ABC = Self::FLAG_A.bits | Self::FLAG_B.bits | Self::FLAG_C.bits;
}
}

View File

@ -23,12 +23,10 @@
//!
//! bitflags! {
//! struct Flags: u32 {
//! const A = 0b00000001;
//! const B = 0b00000010;
//! const C = 0b00000100;
//! const ABC = Self::A.bits
//! | Self::B.bits
//! | Self::C.bits;
//! const A = 0b00000001;
//! const B = 0b00000010;
//! const C = 0b00000100;
//! const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
//! }
//! }
//!
@ -56,8 +54,8 @@
//!
//! bitflags! {
//! struct Flags: u32 {
//! const A = 0b00000001;
//! const B = 0b00000010;
//! const A = 0b00000001;
//! const B = 0b00000010;
//! }
//! }
//!
@ -97,13 +95,13 @@
//! mod example {
//! bitflags! {
//! pub struct Flags1: u32 {
//! const A = 0b00000001;
//! const A = 0b00000001;
//! }
//! }
//! bitflags! {
//! # pub
//! struct Flags2: u32 {
//! const B = 0b00000010;
//! const B = 0b00000010;
//! }
//! }
//! }
@ -179,9 +177,9 @@
//! // Results in default value with bits: 0
//! #[derive(Default)]
//! struct Flags: u32 {
//! const A = 0b00000001;
//! const B = 0b00000010;
//! const C = 0b00000100;
//! const A = 0b00000001;
//! const B = 0b00000010;
//! const C = 0b00000100;
//! }
//! }
//!
@ -199,9 +197,9 @@
//!
//! bitflags! {
//! struct Flags: u32 {
//! const A = 0b00000001;
//! const B = 0b00000010;
//! const C = 0b00000100;
//! const A = 0b00000001;
//! const B = 0b00000010;
//! const C = 0b00000100;
//! }
//! }
//!
@ -243,12 +241,10 @@ pub extern crate core as _core;
///
/// bitflags! {
/// struct Flags: u32 {
/// const A = 0b00000001;
/// const B = 0b00000010;
/// const C = 0b00000100;
/// const ABC = Self::A.bits
/// | Self::B.bits
/// | Self::C.bits;
/// const A = 0b00000001;
/// const B = 0b00000010;
/// const C = 0b00000100;
/// const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
/// }
/// }
///
@ -273,8 +269,8 @@ pub extern crate core as _core;
///
/// bitflags! {
/// struct Flags: u32 {
/// const A = 0b00000001;
/// const B = 0b00000010;
/// const A = 0b00000001;
/// const B = 0b00000010;
/// }
/// }
///
@ -733,16 +729,14 @@ mod tests {
#[doc = "> "]
#[doc = "> - Richard Feynman"]
struct Flags: u32 {
const A = 0b00000001;
const A = 0b00000001;
#[doc = "<pcwalton> macros are way better at generating code than trans is"]
const B = 0b00000010;
const C = 0b00000100;
const B = 0b00000010;
const C = 0b00000100;
#[doc = "* cmr bed"]
#[doc = "* strcat table"]
#[doc = "<strcat> wait what?"]
const ABC = Self::A.bits
| Self::B.bits
| Self::C.bits;
const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
}
}
@ -1067,11 +1061,11 @@ mod tests {
bitflags! {
/// baz
struct Flags: foo::Bar {
const A = 0b00000001;
const A = 0b00000001;
#[cfg(foo)]
const B = 0b00000010;
const B = 0b00000010;
#[cfg(foo)]
const C = 0b00000010;
const C = 0b00000010;
}
}
}

View File

@ -4,12 +4,12 @@ extern crate bitflags;
mod example {
bitflags! {
pub struct Flags1: u32 {
const FLAG_A = 0b00000001;
const FLAG_A = 0b00000001;
}
}
bitflags! {
struct Flags2: u32 {
const FLAG_B = 0b00000010;
const FLAG_B = 0b00000010;
}
}
}

View File

@ -9,7 +9,7 @@ use core::fmt::Display;
bitflags! {
/// baz
struct Flags: u32 {
const A = 0b00000001;
const A = 0b00000001;
}
}

View File

@ -4,12 +4,12 @@ extern crate bitflags;
bitflags! {
/// baz
struct Flags: u32 {
const A = 0b00000001;
const A = 0b00000001;
#[doc = "bar"]
const B = 0b00000010;
const C = 0b00000100;
const B = 0b00000010;
const C = 0b00000100;
#[doc = "foo"]
const ABC = Flags::A.bits | Flags::B.bits | Flags::C.bits;
const ABC = Flags::A.bits | Flags::B.bits | Flags::C.bits;
}
}

View File

@ -6,12 +6,12 @@ extern crate bitflags;
bitflags! {
/// baz
struct Flags: u32 {
const A = 0b00000001;
const A = 0b00000001;
#[doc = "bar"]
const B = 0b00000010;
const C = 0b00000100;
const B = 0b00000010;
const C = 0b00000100;
#[doc = "foo"]
const ABC = Flags::A.bits | Flags::B.bits | Flags::C.bits;
const ABC = Flags::A.bits | Flags::B.bits | Flags::C.bits;
}
}

View File

@ -8,10 +8,10 @@ extern crate bitflags;
bitflags! {
/// baz
struct Flags128: u128 {
const A = 0x0000_0000_0000_0000_0000_0000_0000_0001;
const B = 0x0000_0000_0000_1000_0000_0000_0000_0000;
const C = 0x8000_0000_0000_0000_0000_0000_0000_0000;
const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
const A = 0x0000_0000_0000_0000_0000_0000_0000_0001;
const B = 0x0000_0000_0000_1000_0000_0000_0000_0000;
const C = 0x8000_0000_0000_0000_0000_0000_0000_0000;
const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
}
}