diff options
| author | Ayaz Hafiz <ayaz.hafiz.1@gmail.com> | 2020-06-21 15:49:56 -0700 |
|---|---|---|
| committer | Ayaz Hafiz <ayaz.hafiz.1@gmail.com> | 2020-06-23 09:25:46 -0700 |
| commit | 7c1b3aa0ddb81954a804455ca45fcf09fdb17dd8 (patch) | |
| tree | 1c06cac9a0fe6823ddd62f563195399b5f5151cd | |
| parent | 7c15f30701d636a7699a7ba8e7d683c351a4bb0a (diff) | |
| download | rust-7c1b3aa0ddb81954a804455ca45fcf09fdb17dd8.tar.gz rust-7c1b3aa0ddb81954a804455ca45fcf09fdb17dd8.zip | |
Record span of `const` kw in GenericParamKind
Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/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 :slightly_smiling_face:
| -rwxr-xr-x | clippy_lints/src/utils/ast_utils.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/utils/ast_utils.rs b/clippy_lints/src/utils/ast_utils.rs index e60e2a81e07..e19a79dd8da 100755 --- a/clippy_lints/src/utils/ast_utils.rs +++ b/clippy_lints/src/utils/ast_utils.rs @@ -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)) |
