@@ -68,13 +68,13 @@ The second part of the motivation is clippy's dependence on unstable
6868compiler-internal data structures. Clippy lints are currently written against
6969the compiler's AST / HIR which means that even small changes in these data
7070structures might break a lot of lints. The second goal of this RFC is to ** make
71- lints independant of the compiler's AST / HIR data structures** .
71+ lints independent of the compiler's AST / HIR data structures** .
7272
7373# Approach
7474
7575A lot of complexity in writing lints currently seems to come from having to
7676manually implement the matching logic (see code samples above). It's an
77- imparative style that describes * how* to match a syntax tree node instead of
77+ imperative style that describes * how* to match a syntax tree node instead of
7878specifying * what* should be matched against declaratively. In other areas, it's
7979common to use declarative patterns to describe desired information and let the
8080implementation do the actual matching. A well-known example of this approach are
@@ -270,7 +270,7 @@ pattern!{
270270 // matches if expressions that **may or may not** have an else block
271271 // Attn: `If(_, _, _)` matches only ifs that **have** an else block
272272 //
273- // | if with else block | if witout else block
273+ // | if with else block | if without else block
274274 // If(_, _, _) | match | no match
275275 // If(_, _, _?) | match | match
276276 // If(_, _, ()) | no match | match
@@ -568,7 +568,7 @@ another example, `Array( Lit(_)* )` is a valid pattern because the parameter of
568568
569569## The IsMatch Trait
570570
571- The pattern syntax and the * PatternTree* are independant of specific syntax tree
571+ The pattern syntax and the * PatternTree* are independent of specific syntax tree
572572implementations (rust ast / hir, syn, ...). When looking at the different
573573pattern examples in the previous sections, it can be seen that the patterns
574574don't contain any information specific to a certain syntax tree implementation.
@@ -717,7 +717,7 @@ if false {
717717#### Problems
718718
719719Extending Rust syntax (which is quite complex by itself) with additional syntax
720- needed for specifying patterns (alternations, sequences, repetisions , named
720+ needed for specifying patterns (alternations, sequences, repetitions , named
721721submatches, ...) might become difficult to read and really hard to parse
722722properly.
723723
@@ -858,7 +858,7 @@ would be evaluated as soon as the `Block(_)#then` was matched.
858858Another idea in this area would be to introduce a syntax for backreferences.
859859They could be used to require that multiple parts of a pattern should match the
860860same value. For example, the ` assign_op_pattern ` lint that searches for `a = a
861- op b` and recommends changing it to ` a op= b` requires that both occurrances of
861+ op b` and recommends changing it to ` a op= b` requires that both occurrences of
862862` a ` are the same. Using ` =#... ` as syntax for backreferences, the lint could be
863863implemented like this:
864864
@@ -882,7 +882,7 @@ least two return statements" could be a practical addition.
882882For patterns like " a literal that is not a boolean literal" one currently needs
883883to list all alternatives except the boolean case . Introducing a negation
884884operator that allows to write `Lit (! Bool (_ ))` might be a good idea . This pattern
885- would be eqivalent to `Lit ( Char (_ ) | Int (_ ) )` (given that currently only three
885+ would be equivalent to `Lit ( Char (_ ) | Int (_ ) )` (given that currently only three
886886literal types are implemented ).
887887
888888#### Functional composition
0 commit comments