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

pub struct NoCompareNegZero {}

Disallow comparison against -0 which yields unexpected behavior.

Comparison against -0 causes unwanted behavior because it passes for both -0 and +0. That is, x == -0 and x == +0 both pass under the same circumstances. If a user wishes to compare against -0 they should use Object.is(x, -0).

Incorrect Code Examples

if (x === -0) {
       // ^^ this comparison works for both -0 and +0
}

Correct code examples

if (x === 0) {
    /* */
}
if (Object.is(x, -0)) {
    /* */
}

Implementations

impl NoCompareNegZero[src]

pub fn new() -> Self[src]

Trait Implementations

impl Clone for NoCompareNegZero[src]

impl CstRule for NoCompareNegZero[src]

impl Debug for NoCompareNegZero[src]

impl Default for NoCompareNegZero[src]

impl<'de> Deserialize<'de> for NoCompareNegZero[src]

impl Rule for NoCompareNegZero[src]

impl Serialize for NoCompareNegZero[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.