Skip to content

Commit

Permalink
Record span of const kw in GenericParamKind
Browse files Browse the repository at this point in the history
Context: this is needed to fix rust-lang/rustfmt#4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂
  • Loading branch information
ayazhafiz committed Jun 23, 2020
1 parent 7c15f30 commit 7c1b3aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/ast_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ pub fn eq_generic_param(l: &GenericParam, r: &GenericParam) -> bool {
&& match (&l.kind, &r.kind) {
(Lifetime, Lifetime) => true,
(Type { default: l }, Type { default: r }) => both(l, r, |l, r| eq_ty(l, r)),
(Const { ty: l }, Const { ty: r }) => eq_ty(l, r),
(Const { ty: l, kw_span: _ }, Const { ty: r, kw_span: _ }) => eq_ty(l, r),
_ => false,
}
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
Expand Down

0 comments on commit 7c1b3aa

Please sign in to comment.