[][src]Struct rslint_core::groups::errors::NoExtraBooleanCast

pub struct NoExtraBooleanCast {
    pub enforce_for_logical_operands: bool,
}

Disallow unnecessary boolean casts.

In contexts where expression will be coerced to a Boolean (e.g. if), casting to a boolean (using !! or Boolean(expr)) is unnecessary.

Invalid Code Examples

if (!!foo) {}
while (!!foo) {}

var foo = !!!bar;
var foo = Boolean(!!bar);

Fields

enforce_for_logical_operands: bool

If this option is true, this rule will also check for unnecessary boolean cast inside logical expression, which is disabled by default.

Implementations

impl NoExtraBooleanCast[src]

pub fn new() -> Self[src]

Trait Implementations

impl Clone for NoExtraBooleanCast[src]

impl CstRule for NoExtraBooleanCast[src]

impl Debug for NoExtraBooleanCast[src]

impl Default for NoExtraBooleanCast[src]

impl<'de> Deserialize<'de> for NoExtraBooleanCast where
    NoExtraBooleanCast: Default
[src]

impl Rule for NoExtraBooleanCast[src]

impl Serialize for NoExtraBooleanCast[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> Erasable for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Serialize for T where
    T: Serialize + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.