Various minor/cosmetic improvements to code
This commit is contained in:
parent
4a45578bc5
commit
ee89c088b0
457 changed files with 2384 additions and 2360 deletions
|
@ -92,12 +92,12 @@ pub enum PathStyle {
|
|||
/// `x<y>` - comparisons, `x::<y>` - unambiguously a path.
|
||||
Expr,
|
||||
/// In other contexts, notably in types, no ambiguity exists and paths can be written
|
||||
/// without the disambiguator, e.g. `x<y>` - unambiguously a path.
|
||||
/// without the disambiguator, e.g., `x<y>` - unambiguously a path.
|
||||
/// Paths with disambiguators are still accepted, `x::<Y>` - unambiguously a path too.
|
||||
Type,
|
||||
/// A path with generic arguments disallowed, e.g. `foo::bar::Baz`, used in imports,
|
||||
/// A path with generic arguments disallowed, e.g., `foo::bar::Baz`, used in imports,
|
||||
/// visibilities or attributes.
|
||||
/// Technically, this variant is unnecessary and e.g. `Expr` can be used instead
|
||||
/// Technically, this variant is unnecessary and e.g., `Expr` can be used instead
|
||||
/// (paths in "mod" contexts have to be checked later for absence of generic arguments
|
||||
/// anyway, due to macros), but it is used to avoid weird suggestions about expected
|
||||
/// tokens when something goes wrong.
|
||||
|
@ -1917,7 +1917,7 @@ impl<'a> Parser<'a> {
|
|||
self.parse_arg_general(true)
|
||||
}
|
||||
|
||||
/// Parse an argument in a lambda header e.g. |arg, arg|
|
||||
/// Parse an argument in a lambda header e.g., |arg, arg|
|
||||
fn parse_fn_block_arg(&mut self) -> PResult<'a, Arg> {
|
||||
let pat = self.parse_pat(Some("argument name"))?;
|
||||
let t = if self.eat(&token::Colon) {
|
||||
|
@ -2334,7 +2334,7 @@ impl<'a> Parser<'a> {
|
|||
/// parse things like parenthesized exprs,
|
||||
/// macros, return, etc.
|
||||
///
|
||||
/// NB: This does not parse outer attributes,
|
||||
/// N.B., this does not parse outer attributes,
|
||||
/// and is private because it only works
|
||||
/// correctly if called from parse_dot_or_call_expr().
|
||||
fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
|
||||
|
@ -3732,7 +3732,7 @@ impl<'a> Parser<'a> {
|
|||
self.with_res(r, |this| this.parse_assoc_expr(already_parsed_attrs))
|
||||
}
|
||||
|
||||
/// Parse the RHS of a local variable declaration (e.g. '= 14;')
|
||||
/// Parse the RHS of a local variable declaration (e.g., '= 14;')
|
||||
fn parse_initializer(&mut self, skip_eq: bool) -> PResult<'a, Option<P<Expr>>> {
|
||||
if self.eat(&token::Eq) {
|
||||
Ok(Some(self.parse_expr()?))
|
||||
|
@ -4114,7 +4114,7 @@ impl<'a> Parser<'a> {
|
|||
self.parse_pat_with_range_pat(true, expected)
|
||||
}
|
||||
|
||||
/// Parse a pattern, with a setting whether modern range patterns e.g. `a..=b`, `a..b` are
|
||||
/// Parse a pattern, with a setting whether modern range patterns e.g., `a..=b`, `a..b` are
|
||||
/// allowed.
|
||||
fn parse_pat_with_range_pat(
|
||||
&mut self,
|
||||
|
@ -4456,7 +4456,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
/// Parse a statement. This stops just before trailing semicolons on everything but items.
|
||||
/// e.g. a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed.
|
||||
/// e.g., a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed.
|
||||
pub fn parse_stmt(&mut self) -> PResult<'a, Option<Stmt>> {
|
||||
Ok(self.parse_stmt_(true))
|
||||
}
|
||||
|
@ -5053,9 +5053,9 @@ impl<'a> Parser<'a> {
|
|||
|
||||
// Parse bounds of a type parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
|
||||
// BOUND = TY_BOUND | LT_BOUND
|
||||
// LT_BOUND = LIFETIME (e.g. `'a`)
|
||||
// LT_BOUND = LIFETIME (e.g., `'a`)
|
||||
// TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN)
|
||||
// TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g. `?for<'a: 'b> m::Trait<'a>`)
|
||||
// TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g., `?for<'a: 'b> m::Trait<'a>`)
|
||||
fn parse_generic_bounds_common(&mut self, allow_plus: bool) -> PResult<'a, GenericBounds> {
|
||||
let mut bounds = Vec::new();
|
||||
loop {
|
||||
|
@ -5110,7 +5110,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
// Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
|
||||
// BOUND = LT_BOUND (e.g. `'a`)
|
||||
// BOUND = LT_BOUND (e.g., `'a`)
|
||||
fn parse_lt_param_bounds(&mut self) -> GenericBounds {
|
||||
let mut lifetimes = Vec::new();
|
||||
while self.check_lifetime() {
|
||||
|
@ -6293,7 +6293,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
/// Parse `pub`, `pub(crate)` and `pub(in path)` plus shortcuts `crate` for `pub(crate)`,
|
||||
/// `pub(self)` for `pub(in self)` and `pub(super)` for `pub(in super)`.
|
||||
/// If the following element can't be a tuple (i.e. it's a function definition,
|
||||
/// If the following element can't be a tuple (i.e., it's a function definition,
|
||||
/// it's not a tuple struct field) and the contents within the parens
|
||||
/// isn't valid, emit a proper diagnostic.
|
||||
pub fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibility> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue