[−][src]Struct rslint_core::groups::errors::NoConfusingArrow
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]
Trait Implementations
impl Clone for NoConfusingArrow
[src]
fn clone(&self) -> NoConfusingArrow
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl CstRule for NoConfusingArrow
[src]
fn check_node(&self, node: &SyntaxNode, ctx: &mut RuleCtx) -> Option<()>
[src]
fn check_token(&self, token: &SyntaxToken, ctx: &mut RuleCtx) -> Option<()>
[src]
fn check_root(&self, root: &SyntaxNode, ctx: &mut RuleCtx) -> Option<()>
[src]
impl Debug for NoConfusingArrow
[src]
impl Default for NoConfusingArrow
[src]
impl<'de> Deserialize<'de> for NoConfusingArrow where
NoConfusingArrow: Default,
[src]
NoConfusingArrow: Default,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Rule for NoConfusingArrow
[src]
fn name(&self) -> &'static str
[src]
fn group(&self) -> &'static str
[src]
fn docs(&self) -> &'static str
[src]
impl Serialize for NoConfusingArrow
[src]
Auto Trait Implementations
impl RefUnwindSafe for NoConfusingArrow
impl Send for NoConfusingArrow
impl Sync for NoConfusingArrow
impl Unpin for NoConfusingArrow
impl UnwindSafe for NoConfusingArrow
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
fn __clone_box(&self, Private) -> *mut ()
[src]
impl<T> Erasable for T
unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>
const ACK_1_1_0: bool
fn erase(this: NonNull<Self>) -> NonNull<Erased>
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,