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

pub struct NoConfusingArrow {
    pub allow_parens: bool,
}

Disallow arrow functions where they could be confused with comparisons.

Arrow functions (=>) are similar in syntax to some comparison operators (>, <, <=, and >=). This rule warns against using the arrow function syntax in places where it could be confused with a comparison operator

Here's an example where the usage of => could be confusing:

// The intent is not clear
var x = a => 1 ? 2 : 3;
// Did the author mean this
var x = function (a) { return 1 ? 2 : 3 };
// Or this
var x = a >= 1 ? 2 : 3;

Incorrect Code Examples

var x = a => 1 ? 2 : 3;
var x = (a) => 1 ? 2 : 3;

Fields

allow_parens: bool

Relaxes the rule and accepts parenthesis as a valid "confusion-preventing" syntax. true by default.

Implementations

impl NoConfusingArrow[src]

pub fn new() -> Self[src]

Trait Implementations

impl Clone for NoConfusingArrow[src]

impl CstRule for NoConfusingArrow[src]

impl Debug for NoConfusingArrow[src]

impl Default for NoConfusingArrow[src]

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

impl Rule for NoConfusingArrow[src]

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