Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #156518 - estebank:match-rustfmt, r=mejrs
[style] rustfmt `match`es with comments in or-patterns
Using https://github.com/rust-lang/rustfmt/pull/6893, I reformatted the whole codebase. The result is that `match`es that *should have* been formatted under normal circumstances but are getting skipped now got their expected format. These match expressions were being entirely skipped because they contain or-patterns with comments in between patterns, causing rustfmt to bail out entirely. The or-patterns with comments themselves remain untouched, but now the match arm bodies and other patterns without comments do get formatted under that PR.
Because the fix in rustfmt isn't landed yet, I reworked some of the or-patterns with comments so that formatting doesn't regress. Tried doing this only in larger blocks that are more likely to regress in the meantime.
(Introduced and) removed a bunch of stray backticks \` likely left after an editor autoclosed the intended closing \`, resulting in <code>\`name\`\`</code> in comments.
| -rw-r--r-- | crates/hir-ty/src/traits.rs | 10 | ||||
| -rw-r--r-- | crates/mbe/src/parser.rs | 2 | ||||
| -rw-r--r-- | crates/project-model/src/workspace.rs | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir-ty/src/traits.rs b/crates/hir-ty/src/traits.rs index ad1c3fb709..9582f2ceba 100644 --- a/crates/hir-ty/src/traits.rs +++ b/crates/hir-ty/src/traits.rs @@ -232,11 +232,11 @@ pub fn is_inherent_impl_coherent(db: &dyn HirDatabase, def_map: &DefMap, impl_id /// Checks whether the impl satisfies the orphan rules. /// -/// Given `impl<P1..=Pn> Trait<T1..=Tn> for T0`, an `impl`` is valid only if at least one of the following is true: +/// Given `impl<P1..=Pn> Trait<T1..=Tn> for T0`, an `impl` is valid only if at least one of the following is true: /// - Trait is a local trait /// - All of -/// - At least one of the types `T0..=Tn`` must be a local type. Let `Ti`` be the first such type. -/// - No uncovered type parameters `P1..=Pn` may appear in `T0..Ti`` (excluding `Ti`) +/// - At least one of the types `T0..=Tn` must be a local type. Let `Ti` be the first such type. +/// - No uncovered type parameters `P1..=Pn` may appear in `T0..Ti` (excluding `Ti`) pub fn check_orphan_rules<'db>(db: &'db dyn HirDatabase, impl_: ImplId) -> bool { let Some(impl_trait) = db.impl_trait(impl_) else { // not a trait impl @@ -277,10 +277,10 @@ pub fn check_orphan_rules<'db>(db: &'db dyn HirDatabase, impl_: ImplId) -> bool } } }; - // - At least one of the types `T0..=Tn`` must be a local type. Let `Ti`` be the first such type. + // - At least one of the types `T0..=Tn` must be a local type. Let `Ti` be the first such type. // FIXME: param coverage - // - No uncovered type parameters `P1..=Pn` may appear in `T0..Ti`` (excluding `Ti`) + // - No uncovered type parameters `P1..=Pn` may appear in `T0..Ti` (excluding `Ti`) let is_not_orphan = trait_ref.args.types().any(|ty| match unwrap_fundamental(ty).kind() { TyKind::Adt(adt_def, _) => is_local(adt_def.def_id().module(db).krate(db)), TyKind::Error(_) => true, diff --git a/crates/mbe/src/parser.rs b/crates/mbe/src/parser.rs index 796ee62d48..9fbd06cf88 100644 --- a/crates/mbe/src/parser.rs +++ b/crates/mbe/src/parser.rs @@ -109,7 +109,7 @@ pub(crate) enum Op { }, Count { name: Symbol, - // FIXME: `usize`` once we drop support for 1.76 + // FIXME: `usize` once we drop support for 1.76 depth: Option<usize>, }, Concat { diff --git a/crates/project-model/src/workspace.rs b/crates/project-model/src/workspace.rs index 29a19bc32e..675533645d 100644 --- a/crates/project-model/src/workspace.rs +++ b/crates/project-model/src/workspace.rs @@ -748,7 +748,7 @@ impl ProjectWorkspace { .packages() .filter_map(|pkg| { if ws[pkg].is_local { - // the local ones are included in the main `PackageRoot`` below + // the local ones are included in the main `PackageRoot` below return None; } let pkg_root = ws[pkg].manifest.parent().to_path_buf(); |