struct PositionalNamedArgsLint {
    positional_named_args: Vec<PositionalNamedArg>,
}
Expand description

Encapsulates all the named arguments that have been used positionally

Fields

positional_named_args: Vec<PositionalNamedArg>

Implementations

For a given positional argument, check if the index is for a named argument.

Since positional arguments are required to come before named arguments, if the positional index is greater than or equal to the start of named arguments, we know it’s a named argument used positionally.

Example: println!(“{} {} {2}”, 0, a=1, b=2);

In this case, the first piece ({}) would be ArgumentImplicitlyIs with an index of 0. The total number of arguments is 3 and the number of named arguments is 2, so the start of named arguments is index 1. Therefore, the index of 0 is okay.

The second piece ({}) would be ArgumentImplicitlyIs with an index of 1, which is the start of named arguments, and so we should add a lint to use the named argument a.

The third piece ({2}) would be ArgumentIs with an index of 2, which is greater than the start of named arguments, and so we should add a lint to use the named argument b.

This same check also works for width and precision formatting when either or both are CountIsParam, which contains an index into the arguments.

Construct a PositionalNamedArg struct and push it into the vec of positional named arguments.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 24 bytes