Run rustfmt on nightly to clean up erroneous comments (#5106)

## Summary

This PR runs `rustfmt` with a few nightly options as a one-time fix to
catch some malformatted comments. I ended up just running with:

```toml
condense_wildcard_suffixes = true
edition = "2021"
max_width = 100
normalize_comments = true
normalize_doc_attributes = true
reorder_impl_items = true
unstable_features = true
use_field_init_shorthand = true
```

Since these all seem like reasonable things to fix, so may as well while
I'm here.
This commit is contained in:
Charlie Marsh 2023-06-14 20:19:05 -04:00 committed by GitHub
parent 9ab16fb417
commit 716cab2f19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 49 additions and 34 deletions

View file

@ -160,8 +160,8 @@ impl ImportMap {
}
impl<'a> IntoIterator for &'a ImportMap {
type Item = (&'a String, &'a Vec<ModuleImport>);
type IntoIter = std::collections::hash_map::Iter<'a, String, Vec<ModuleImport>>;
type Item = (&'a String, &'a Vec<ModuleImport>);
fn into_iter(self) -> Self::IntoIter {
self.module_to_imports.iter()

View file

@ -25,8 +25,8 @@ impl Debug for CommentRanges {
}
impl<'a> IntoIterator for &'a CommentRanges {
type Item = &'a TextRange;
type IntoIter = std::slice::Iter<'a, TextRange>;
type Item = &'a TextRange;
fn into_iter(self) -> Self::IntoIter {
self.raw.iter()

View file

@ -245,12 +245,11 @@ impl IndexKind {
pub struct OneIndexed(NonZeroUsize);
impl OneIndexed {
/// The largest value that can be represented by this integer type
pub const MAX: Self = unwrap(Self::new(usize::MAX));
// SAFETY: These constants are being initialized with non-zero values
/// The smallest value that can be represented by this integer type.
pub const MIN: Self = unwrap(Self::new(1));
/// The largest value that can be represented by this integer type
pub const MAX: Self = unwrap(Self::new(usize::MAX));
pub const ONE: NonZeroUsize = unwrap(NonZeroUsize::new(1));
/// Creates a non-zero if the given value is not zero.

View file

@ -1078,23 +1078,29 @@ class A:
walk_expr(self, expr);
self.exit_node();
}
fn visit_expr(&mut self, expr: &Expr) {
self.enter_node(expr);
walk_expr(self, expr);
self.exit_node();
}
fn visit_constant(&mut self, constant: &Constant) {
self.emit(&constant);
}
fn visit_boolop(&mut self, boolop: &Boolop) {
self.emit(&boolop);
}
fn visit_operator(&mut self, operator: &Operator) {
self.emit(&operator);
}
fn visit_unaryop(&mut self, unaryop: &Unaryop) {
self.emit(&unaryop);
}
fn visit_cmpop(&mut self, cmpop: &Cmpop) {
self.emit(&cmpop);
}
@ -1104,51 +1110,61 @@ class A:
walk_comprehension(self, comprehension);
self.exit_node();
}
fn visit_excepthandler(&mut self, excepthandler: &Excepthandler) {
self.enter_node(excepthandler);
walk_excepthandler(self, excepthandler);
self.exit_node();
}
fn visit_format_spec(&mut self, format_spec: &Expr) {
self.enter_node(format_spec);
walk_expr(self, format_spec);
self.exit_node();
}
fn visit_arguments(&mut self, arguments: &Arguments) {
self.enter_node(arguments);
walk_arguments(self, arguments);
self.exit_node();
}
fn visit_arg(&mut self, arg: &Arg) {
self.enter_node(arg);
walk_arg(self, arg);
self.exit_node();
}
fn visit_keyword(&mut self, keyword: &Keyword) {
self.enter_node(keyword);
walk_keyword(self, keyword);
self.exit_node();
}
fn visit_alias(&mut self, alias: &Alias) {
self.enter_node(alias);
walk_alias(self, alias);
self.exit_node();
}
fn visit_withitem(&mut self, withitem: &Withitem) {
self.enter_node(withitem);
walk_withitem(self, withitem);
self.exit_node();
}
fn visit_match_case(&mut self, match_case: &MatchCase) {
self.enter_node(match_case);
walk_match_case(self, match_case);
self.exit_node();
}
fn visit_pattern(&mut self, pattern: &Pattern) {
self.enter_node(pattern);
walk_pattern(self, pattern);
self.exit_node();
}
fn visit_type_ignore(&mut self, type_ignore: &TypeIgnore) {
self.enter_node(type_ignore);
walk_type_ignore(self, type_ignore);