Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy subtree update #134788

Merged
merged 171 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
d1cab08
Fix `shadow_unrelated`'s behaviour with closures
DJMcNab Nov 12, 2024
febe549
Fix needless_match FP on if-lets
blyxyas Nov 2, 2024
cd7cec9
Add new `literal_string_with_formatting_arg` lint
GuillaumeGomez Sep 17, 2024
922aabe
Add regression test for `literal_string_with_formatting_arg`
GuillaumeGomez Sep 17, 2024
05705b6
Update new failing tests
GuillaumeGomez Sep 18, 2024
8d5a4e9
Allow `literal_string_with_formatting_arg` in some clippy crates
GuillaumeGomez Sep 19, 2024
9ea769a
Disable checks on `{}`
GuillaumeGomez Sep 19, 2024
b20b75a
Don't emit if literal comes from macro expansion
GuillaumeGomez Sep 19, 2024
607a3f6
Rename `literal_string_with_formatting_arg` into `literal_string_with…
GuillaumeGomez Nov 19, 2024
cfc6444
Limit `literal_string_with_formatting_args` to known variables if no …
GuillaumeGomez Nov 19, 2024
3a7a185
cover guard patterns in clippy lints
max-niederman Oct 6, 2024
44feca7
doc_nested_refdefs: new lint for suspicious refdef syntax
notriddle Nov 19, 2024
8dd45f1
doc_nested_refdefs: apply suggestions
notriddle Nov 27, 2024
66e212b
Extend `precedence` for bitmasking and shift
Natsume-Neko Nov 28, 2024
d58b911
Merge commit 'ff4a26d442bead94a4c96fb1de967374bc4fbd8e' into clippy-s…
flip1995 Nov 28, 2024
8de6e86
Stop using `HybridBitSet` in clippy.
nnethercote Nov 25, 2024
f5f2c51
Update backport, release and sync documentation
flip1995 Nov 17, 2024
af1f78a
Update backport, release and sync documentation (#13700)
flip1995 Nov 29, 2024
1e88cf4
Auto merge of #133588 - flip1995:clippy-subtree-update, r=Manishearth
bors Nov 29, 2024
21115b3
refactor(utils): move top-level files to `mod.rs` when applicable
BD103 Nov 26, 2024
1329547
add targetted help messages to `zombie_processes` diagnostic
y21 Nov 29, 2024
120b841
Modified the tests so that if we place wrong parentheses we will get …
Natsume-Neko Nov 30, 2024
650e0c8
Fix `shadow_unrelated`'s behaviour with closures (#13677)
Jarcho Nov 30, 2024
a6a6936
Remove hir::ArrayLen, introduce ConstArgKind::Infer
voidc Nov 28, 2024
ce9c4f8
Mention `string_slice` in `indexing_slicing` documentation
samueltardieu Nov 30, 2024
9a692ec
Add more cases to the `useless_conversion` lint
samueltardieu Nov 29, 2024
2b0e7bb
Fix lifetimes elision suggestion in where clauses
samueltardieu Nov 29, 2024
736d114
Extract lint namespace and lint name from the meta item
samueltardieu Nov 30, 2024
092bfef
Do not mark attributes with unknown namespace as useless
samueltardieu Nov 30, 2024
c52fe8b
Eliminate magic numbers from expression precedence
dtolnay Nov 28, 2024
1f966e9
Add new `literal_string_with_formatting_args` lint (#13410)
xFrednet Dec 1, 2024
0a1ba2c
Mention `string_slice` in `indexing_slicing` documentation (#13763)
y21 Dec 1, 2024
92badb3
`typing_env_env_for_derived_eq` -> `typing_env_for_derived_eq`
smoelius Dec 1, 2024
278e316
Fix needless_match FP on if-lets (#13646)
Centri3 Dec 2, 2024
5e799b2
Rollup merge of #133589 - voidc:remove-array-len, r=boxyuwu
jhpratt Dec 2, 2024
5082adf
Change `AttrArgs::Eq` into a struct variant
oli-obk Dec 2, 2024
b330d96
remove `Ty::is_copy_modulo_regions`
lcnr Dec 2, 2024
ab5d55c
Add more receivers to `useless_conversion`
samueltardieu Nov 30, 2024
0a07dc5
`typing_env_env_for_derived_eq` -> `typing_env_for_derived_eq` (#13769)
Jarcho Dec 2, 2024
2ddfc92
Add more cases to the `useless_conversion` lint (#13756)
blyxyas Dec 2, 2024
e66bd97
Rollup merge of #133603 - dtolnay:precedence, r=lcnr
GuillaumeGomez Dec 2, 2024
a0a948d
Rollup merge of #133751 - lcnr:no-trait-solving-on-type, r=compiler-e…
GuillaumeGomez Dec 2, 2024
c8d800e
Drop uplifted `clippy::fn_address_comparisons`
Urgau Dec 10, 2023
74dd50c
Fix lifetimes elision suggestion in where clauses (#13752)
Manishearth Dec 2, 2024
df46e4c
add targeted help messages to `zombie_processes` diagnostic (#13760)
Manishearth Dec 2, 2024
66b15ad
doc_nested_refdefs: new lint for suspicious list syntax (#13707)
Jarcho Dec 2, 2024
4a342df
Correct `report_elidable_impl_lifetimes` comment following #13752
smoelius Dec 2, 2024
646d72a
Correct `report_elidable_impl_lifetimes` comment following #13752 (#1…
blyxyas Dec 2, 2024
f850d15
Rollup merge of #133746 - oli-obk:push-xwyrylxmrtvq, r=jieyouxu
GuillaumeGomez Dec 2, 2024
d3a7fb1
doc_lazy_continuation: Correctly count indent with backslashes
notriddle Nov 28, 2024
ec24388
let_unit_value: Use multipart suggestions
scottgerring Dec 3, 2024
e493664
index_refutable_slice: use multipart suggestions
scottgerring Dec 3, 2024
19426bf
doc_lazy_continuation: Correctly count indent with backslashes (#13742)
Jarcho Dec 3, 2024
2550530
Extend `precedence` for bitmasking and shift (#13743)
Jarcho Dec 3, 2024
7cc19d7
Rollup merge of #118833 - Urgau:lint_function_pointer_comparisons, r=…
fmease Dec 5, 2024
c8b10ac
fix the order of emitting `ref_as_ptr` and `borrow_as_ptr`
cyrgani Dec 5, 2024
9925f99
update `borrow_as_ptr` to suggest `&raw` when the MSRV allows it
cyrgani Dec 5, 2024
a5e46a6
update `borrow_as_ptr` to suggest `&raw` syntax (#13689)
Jarcho Dec 5, 2024
4907940
fix: various typos
BD103 Dec 4, 2024
f83a227
Fix various typos (#13785)
blyxyas Dec 5, 2024
c963e22
chore: use multipart_suggestions for manual_async_fn
scottgerring Dec 6, 2024
dcc4025
chore: use multipart_suggestions for str_splitn
scottgerring Dec 6, 2024
63e4979
Remove all threading through of ErrorGuaranteed from the driver
bjorn3 Nov 3, 2024
1496711
new lint for `as *const _` and `as *mut _` casting
Soveu Aug 10, 2024
5198941
chore: use multipart_suggestions for str_splitn (#13789)
Jarcho Dec 6, 2024
7f866c7
New lint for `as *const _` and `as *mut _` pointer casts (#13251)
Jarcho Dec 6, 2024
0a99eec
Update known problems for default_numeric_fallback
Noratrieb Dec 7, 2024
cfee37d
Make `Copy` unsafe to implement for ADTs with `unsafe` fields
jswrenn Dec 6, 2024
d1e1aff
Update known problems for default_numeric_fallback (#13794)
Centri3 Dec 8, 2024
ec37eb6
Move top-level files to `mod.rs` when applicable (#13732)
llogiq Dec 8, 2024
c4aeb32
chore: use multipart_suggestions for manual_async_fn (#13788)
llogiq Dec 8, 2024
24ccb15
Rollup merge of #133424 - Nadrieril:guard-patterns-parsing, r=fee1-dead
matthiaskrgr Dec 8, 2024
69411e0
Better help message for comparison_chain lint
samueltardieu Nov 30, 2024
f51f72b
Detect shadowing in pattern field
samueltardieu Dec 8, 2024
dc71301
Auto merge of #134052 - matthiaskrgr:rollup-puxwqrk, r=matthiaskrgr
bors Dec 9, 2024
a9594c1
fix ICE on type error in promoted
RalfJung Dec 7, 2024
d5059d8
remove unnecessary notations
lapla-cogito Dec 9, 2024
7d1e0da
chore: use multipart_suggestions for match_same_arms
scottgerring Dec 9, 2024
6a3ef93
remove unnecessary notations (#13801)
Jarcho Dec 9, 2024
e767daa
indexing_slicing: Clarify documentation
Wilfred Dec 4, 2024
59392be
Introduce `default_field_values` feature
estebank Aug 24, 2024
6450014
Rollup merge of #134010 - RalfJung:promoted-type-error-ice, r=oli-obk
fmease Dec 10, 2024
ff0a96b
Rollup merge of #134008 - jswrenn:unsafe-fields-copy, r=compiler-errors
fmease Dec 10, 2024
1857833
Auto merge of #134125 - fmease:rollup-u38o3ob, r=fmease
bors Dec 10, 2024
a8d2960
Keep track of parse errors in `mod`s and don't emit resolve errors fo…
estebank Dec 5, 2024
2a28347
Fix: fixed multipart_suggestion in index_refutable_slice uitest (#13…
y21 Dec 10, 2024
f495cec
Remove more traces of anonymous ADTs
compiler-errors Dec 10, 2024
59740a8
Better help message for comparison_chain lint (#13762)
y21 Dec 10, 2024
c2d23ad
Detect shadowing in pattern field (#13797)
Jarcho Dec 11, 2024
1ace535
suggest modified code for if_not_else lint
lapla-cogito Dec 11, 2024
f865ada
Require the `constness` query to only be invoked on things that can h…
oli-obk Dec 10, 2024
b8cd513
allow needless_option_take to report for more cases
ericwu17 Nov 14, 2024
35f4b92
fix version attribute for arbitrary_source_item_ordering lint
lapla-cogito Dec 12, 2024
f2aed50
fix version attribute for `arbitrary_source_item_ordering` lint (#13819)
y21 Dec 12, 2024
db35e30
fix typo
klensy Dec 12, 2024
87af9d0
Fix tools
compiler-errors Dec 10, 2024
f4db5f7
Tweak multispan rendering
estebank Dec 11, 2024
cc9d9cc
Filter empty lines, comments and delimiters from previous to last mul…
estebank Dec 11, 2024
51ff984
Stabilize async closures
compiler-errors Nov 6, 2024
db7e453
chore: use multipart_suggestion in significant_drop_tightening lint
scottgerring Dec 13, 2024
efe3fe9
Fix `single_match` lint being emitted when it should not
GuillaumeGomez Nov 30, 2024
8a09650
Auto merge of #134122 - oli-obk:push-zqnyznxtpnll, r=petrochenkov
bors Dec 13, 2024
e2a0e38
Rollup merge of #133937 - estebank:silence-resolve-errors-from-mod-wi…
matthiaskrgr Dec 13, 2024
9ce2645
Rollup merge of #134140 - compiler-errors:unsafe-binders-ast, r=oli-obk
matthiaskrgr Dec 13, 2024
f3a8d4c
Rename ty_def_id so people will stop using it by accident
compiler-errors Dec 13, 2024
c607408
Fix `single_match` lint being emitted when it should not (#13765)
llogiq Dec 13, 2024
e38fa00
address wrong suggestions when using comparing with byte literal stri…
lapla-cogito Dec 13, 2024
13463cb
correct `single_match` lint suggestion (#13824)
blyxyas Dec 13, 2024
f33deb7
Account for `///` when rendering multiline spans
estebank Dec 13, 2024
695f938
Auto merge of #134269 - matthiaskrgr:rollup-fkshwux, r=matthiaskrgr
bors Dec 13, 2024
503f2bc
Rollup merge of #134181 - estebank:trim-render, r=oli-obk
matthiaskrgr Dec 14, 2024
70ebfbb
Rollup merge of #134265 - compiler-errors:ty_def_id, r=oli-obk
matthiaskrgr Dec 14, 2024
c9c62c4
(Re-)Implement impl_trait_in_bindings
compiler-errors Dec 11, 2024
bfb87b9
indexing_slicing: Clarify documentation (#13780)
dswij Dec 14, 2024
37f79d5
Auto merge of #134294 - matthiaskrgr:rollup-anh6io8, r=matthiaskrgr
bors Dec 14, 2024
25d004d
Auto merge of #134185 - compiler-errors:impl-trait-in-bindings, r=oli…
bors Dec 14, 2024
bd078ad
don't lint for creating an iterator from an empty array in filter_map…
lapla-cogito Dec 14, 2024
5ac1805
chore: use multipart_suggestion in significant_drop_tightening lint (…
xFrednet Dec 14, 2024
bc410fc
Stop handling specialization in clippy's to_string_trait_impl lint
bjorn3 Dec 14, 2024
6240710
allow needless_option_take to report for more cases (#13684)
Centri3 Dec 14, 2024
acf9177
Add some convenience helper methods on `hir::Safety`
oli-obk Dec 13, 2024
4cddd0e
Auto merge of #134258 - bjorn3:no_public_specialization, r=petrochenkov
bors Dec 15, 2024
6a92b85
Rollup merge of #134285 - oli-obk:push-vwrqsqlwnuxo, r=Urgau
Zalathar Dec 15, 2024
e7c27c6
correct suggestion for must_use_unit when there are multiple attributes
lapla-cogito Dec 15, 2024
12edfb8
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Dec 15, 2024
028d87b
Bump nightly version -> 2024-12-15
flip1995 Dec 15, 2024
1dddeab
Rustup (#13832)
flip1995 Dec 15, 2024
f1f1165
fix `must_use_unit` suggestion when there're multiple attributes (#13…
llogiq Dec 15, 2024
b8e569e
chore: use multipart_suggestions for match_same_arms (#13803)
blyxyas Dec 15, 2024
f332026
Rename `value` field to `expr` to simplify later commits' diffs
oli-obk Dec 2, 2024
6dfa37f
Add hir::Attribute
jdonszelmann Oct 16, 2024
7a80f7b
Initial impl `repr_packed_without_abi`
lukaslueg Sep 15, 2024
60dbda2
fix typo in `numeric_arithmetic` logic (#13820)
y21 Dec 15, 2024
4c0177c
Do not suggest using `Error` in `no_std` before Rust 1.81
samueltardieu Dec 15, 2024
8da8da8
Initial impl of `repr_packed_without_abi` (#13398)
Alexendoo Dec 16, 2024
968669b
Do not suggest using `Error` in `no_std` before Rust 1.81 (#13834)
llogiq Dec 16, 2024
1a23b5b
correct suggestion for unnecessary_sort_by in no_std
lapla-cogito Dec 16, 2024
063c5c1
correct suggestion for `unnecessary_sort_by` in `no_std` (#13836)
llogiq Dec 16, 2024
ad695da
Correctly handle string indices in `literal_string_with_formatting_arg`
GuillaumeGomez Dec 16, 2024
77c9ddd
Correctly handle string indices in `literal_string_with_formatting_ar…
flip1995 Dec 16, 2024
6f65a81
split attributes
jdonszelmann Dec 7, 2024
4d05825
rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_st…
jdonszelmann Dec 13, 2024
81c0cf8
fix the team anchor in book
lapla-cogito Dec 17, 2024
0f9cc8d
Don't trigger `filter_map_identity` with an iterator from an empty ar…
Jarcho Dec 17, 2024
8fe39b2
Change unnecessary_iter_cloned to use multipart_suggestion
scottgerring Dec 17, 2024
f8da18c
Do not mark attributes with unknown namespace as useless (#13766)
flip1995 Dec 17, 2024
8ea395e
fix a broken anchor in the book (#13846)
flip1995 Dec 17, 2024
5c200c2
Simplify `RefTokenTreeCursor::look_ahead`.
nnethercote Dec 11, 2024
1cb4dca
Rename `RefTokenTreeCursor`.
nnethercote Dec 11, 2024
9f4941a
chore: starting to fix unnecessary_iter_cloned (#13848)
blyxyas Dec 17, 2024
550d36d
Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spast…
jieyouxu Dec 18, 2024
f415510
introduce `LateParamRegionKind`
lcnr Dec 6, 2024
1e0b59d
Use multipart suggestion in unnecessary_to_owned
nanvel Dec 17, 2024
a775a1b
Use multipart suggestion in `unnecessary_to_owned` (#13847)
Manishearth Dec 19, 2024
54a396a
Auto merge of #133961 - lcnr:borrowck-cleanup, r=jackh726
bors Dec 19, 2024
6f6ddd2
Add allow-indexing-slicing-in-tests option
alex-semenyuk Dec 19, 2024
b3fadd5
Add allow-indexing-slicing-in-tests option (#13854)
llogiq Dec 19, 2024
c772140
Update clippy
scottmcm Dec 15, 2024
4d735d8
Begin to implement type system layer of unsafe binders
compiler-errors Dec 21, 2024
1f8ba33
Fix `has_iter_method` documentation
samueltardieu Dec 22, 2024
592fd34
Fix `has_iter_method` documentation (#13867)
y21 Dec 23, 2024
988042e
chore: multipart suggestions for let_unit_value lint (#13754)
blyxyas Dec 23, 2024
b5fe6ec
Auto merge of #134625 - compiler-errors:unsafe-binders-ty, r=oli-obk
bors Dec 24, 2024
887aa26
add more tests
lapla-cogito Dec 24, 2024
85b6094
auto-fix `if_not_else` (#13809)
llogiq Dec 24, 2024
b28bfbc
fix examples using Ty.kind()
lapla-cogito Dec 25, 2024
dff0294
fix examples using `Ty.kind()` in the book (#13875)
flip1995 Dec 26, 2024
14af404
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Dec 26, 2024
416f7e8
Bump nightly version -> 2024-12-26
flip1995 Dec 26, 2024
609cd31
Rustup (#13881)
flip1995 Dec 26, 2024
8a7d8ec
Merge commit '609cd310be44677ae31d452a17b0f8207e1abfe1' into clippy-s…
flip1995 Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5380,6 +5380,7 @@ Released 2018-09-13
[`arc_with_non_send_sync`]: https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync
[`arithmetic_side_effects`]: https://rust-lang.github.io/rust-clippy/master/index.html#arithmetic_side_effects
[`as_conversions`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions
[`as_pointer_underscore`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_pointer_underscore
[`as_ptr_cast_mut`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_ptr_cast_mut
[`as_underscore`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore
[`assertions_on_constants`]: https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants
Expand Down Expand Up @@ -5490,6 +5491,7 @@ Released 2018-09-13
[`doc_lazy_continuation`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
[`doc_link_with_quotes`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
[`doc_nested_refdefs`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_nested_refdefs
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
[`double_must_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use
[`double_neg`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_neg
Expand Down Expand Up @@ -5685,6 +5687,7 @@ Released 2018-09-13
[`lines_filter_map_ok`]: https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok
[`linkedlist`]: https://rust-lang.github.io/rust-clippy/master/index.html#linkedlist
[`lint_groups_priority`]: https://rust-lang.github.io/rust-clippy/master/index.html#lint_groups_priority
[`literal_string_with_formatting_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#literal_string_with_formatting_args
[`little_endian_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#little_endian_bytes
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
Expand Down Expand Up @@ -5966,6 +5969,7 @@ Released 2018-09-13
[`repeat_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#repeat_once
[`repeat_vec_with_capacity`]: https://rust-lang.github.io/rust-clippy/master/index.html#repeat_vec_with_capacity
[`replace_consts`]: https://rust-lang.github.io/rust-clippy/master/index.html#replace_consts
[`repr_packed_without_abi`]: https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi
[`reserve_after_initialization`]: https://rust-lang.github.io/rust-clippy/master/index.html#reserve_after_initialization
[`rest_pat_in_fully_bound_structs`]: https://rust-lang.github.io/rust-clippy/master/index.html#rest_pat_in_fully_bound_structs
[`result_expect_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_expect_used
Expand Down Expand Up @@ -6210,6 +6214,7 @@ Released 2018-09-13
[`allow-comparison-to-zero`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-comparison-to-zero
[`allow-dbg-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-dbg-in-tests
[`allow-expect-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-expect-in-tests
[`allow-indexing-slicing-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-indexing-slicing-in-tests
[`allow-mixed-uninlined-format-args`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-mixed-uninlined-format-args
[`allow-one-hash-in-raw-strings`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-one-hash-in-raw-strings
[`allow-panic-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-panic-in-tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl LateLintPass<'_> for MyStructLint {
// Get type of `expr`
let ty = cx.typeck_results().expr_ty(expr);
// Match its kind to enter its type
match ty.kind {
match ty.kind() {
ty::Adt(adt_def, _) if adt_def.is_struct() => println!("Our `expr` is a struct!"),
_ => ()
}
Expand Down
126 changes: 83 additions & 43 deletions src/tools/clippy/book/src/development/infrastructure/backport.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,108 @@ Backports in Clippy are rare and should be approved by the Clippy team. For
example, a backport is done, if a crucial ICE was fixed or a lint is broken to a
point, that it has to be disabled, before landing on stable.

Backports are done to the `beta` branch of Clippy. Backports to stable Clippy
releases basically don't exist, since this would require a Rust point release,
which is almost never justifiable for a Clippy fix.
> Note: If you think a PR should be backported you can label it with
> `beta-nominated`. This has to be done before the Thursday the week before the
> release.

## Filtering PRs to backport

## Backport the changes
First, find all labeled PRs using [this filter][beta-accepted-prs].

Next, look at each PR individually. There are a few things to check. Those need
some explanation and are quite subjective. Good judgement is required.

1. **Is the fix worth a backport?**

This is really subjective. An ICE fix usually is. Moving a lint to a _lower_
group (from warn- to allow-by-default) usually as well. An FP fix usually not
(on its own). If a backport is done anyway, FP fixes might also be included.
If the PR has a lot of changes, backports must be considered more carefully.

2. **Is the problem that was fixed by the PR already in `beta`?**

It could be that the problem that was fixed by the PR hasn't made it to the
`beta` branch of the Rust repo yet. If that's the case, and the fix is
already synced to the Rust repo, the fix doesn't need to be backported, as it
will hit stable together with the commit that introduced the problem. If the
fix PR is not synced yet, the fix PR either needs to be "backported" to the
Rust `master` branch or to `beta` in the next backport cycle.

3. **Make sure that the fix is on `master` before porting to `beta`**

The fix must already be synced to the Rust `master` branch. Otherwise, the
next `beta` will be missing this fix again. If it is not yet in `master` it
should probably not be backported. If the backport is really important, do an
out-of-cycle sync first. However, the out-of-cycle sync should be small,
because the changes in that sync will get right into `beta`, without being
tested in `nightly` first.

[beta-accepted-prs]: https://github.com/rust-lang/rust-clippy/issues?q=label%3Abeta-nominated

## Preparation

> Note: All commands in this chapter will be run in the Rust clone.

Follow the instructions in [defining remotes] to define the `clippy-upstream`
remote in the Rust repository.

Backports are done on the beta branch of the Clippy repository.
After that, fetch the remote with

```bash
# Assuming the current directory corresponds to the Clippy repository
$ git checkout beta
$ git checkout -b backport
$ git cherry-pick <SHA> # `<SHA>` is the commit hash of the commit(s), that should be backported
$ git push origin backport
git fetch clippy-upstream master
```

Now you should test that the backport passes all the tests in the Rust
repository. You can do this with:
Then, switch to the `beta` branch:

```bash
# Assuming the current directory corresponds to the Rust repository
$ git checkout beta
# Make sure to change `your-github-name` to your github name in the following command
$ git subtree pull -p src/tools/clippy https://github.com/<your-github-name>/rust-clippy backport
$ ./x.py test src/tools/clippy
git switch beta
git fetch upstream
git reset --hard upstream/beta
```

Should the test fail, you can fix Clippy directly in the Rust repository. This
has to be first applied to the Clippy beta branch and then again synced to the
Rust repository, though. The easiest way to do this is:
[defining remotes]: release.md#defining-remotes

## Backport the changes

When a PR is merged with the GitHub merge queue, the PR is closed with the message

> \<PR title\> (#\<PR number\>)

This commit needs to be backported. To do that, find the `<sha1>` of that commit
and run the following command in the clone of the **Rust repository**:

```bash
# In the Rust repository
$ git diff --patch --relative=src/tools/clippy > clippy.patch
# In the Clippy repository
$ git apply /path/to/clippy.patch
$ git add -u
$ git commit -m "Fix rustup fallout"
$ git push origin backport
git cherry-pick -m 1 `<sha1>`
```

After this, you can open a PR to the `beta` branch of the Clippy repository.
Do this for all PRs that should be backported.

## Open PR in the Rust repository

## Update Clippy in the Rust Repository
Next, open the PR for the backport. Make sure, the PR is opened towards the
`beta` branch and not the `master` branch. The PR description should look like
this:

This step must be done, **after** the PR of the previous step was merged.
```
[beta] Clippy backports

After the backport landed in the Clippy repository, the branch has to be synced
back to the beta branch of the Rust repository.
r? @Mark-Simulacrum

```bash
# Assuming the current directory corresponds to the Rust repository
$ git checkout beta
$ git checkout -b clippy_backport
$ git subtree pull -p src/tools/clippy https://github.com/rust-lang/rust-clippy beta
$ git push origin clippy_backport
Backports:
- <Link to the Clippy PR>
- ...

<Short summary of what is backported and why>
```

Make sure to test the backport in the Rust repository before opening a PR. This
is done with `./x.py test src/tools/clippy`. If that passes all tests, open a PR
to the `beta` branch of the Rust repository. In this PR you should tag the
Clippy team member, that agreed to the backport or the `@rust-lang/clippy` team.
Make sure to add `[beta]` to the title of the PR.
Mark is from the release team and they ultimately have to merge the PR before
branching a new `beta` version. Tag them to take care of the backport. Next,
list all the backports and give a short summary what's backported and why it is
worth backporting this.

## Relabel backported PRs

When a PR is backported to Rust `beta`, label the PR with `beta-accepted`. This
will then get picked up when [writing the changelog].

[writing the changelog]: changelog_update.md#31-include-beta-accepted-prs
128 changes: 65 additions & 63 deletions src/tools/clippy/book/src/development/infrastructure/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,112 +7,114 @@ Clippy is released together with stable Rust releases. The dates for these
releases can be found at the [Rust Forge]. This document explains the necessary
steps to create a Clippy release.

1. [Remerge the `beta` branch](#remerge-the-beta-branch)
2. [Update the `beta` branch](#update-the-beta-branch)
3. [Find the Clippy commit](#find-the-clippy-commit)
4. [Tag the stable commit](#tag-the-stable-commit)
5. [Update `CHANGELOG.md`](#update-changelogmd)

> _NOTE:_ This document is for stable Rust releases, not for point releases. For
> point releases, step 1. and 2. should be enough.
1. [Defining Remotes](#defining-remotes)
1. [Bump Version](#bump-version)
1. [Find the Clippy commit](#find-the-clippy-commit)
1. [Update the `beta` branch](#update-the-beta-branch)
1. [Update the `stable` branch](#update-the-stable-branch)
1. [Tag the stable commit](#tag-the-stable-commit)
1. [Update `CHANGELOG.md`](#update-changelogmd)

[Rust Forge]: https://forge.rust-lang.org/

## Remerge the `beta` branch
## Defining Remotes

You may want to define the `upstream` remote of the Clippy project to simplify
the following steps. However, this is optional and you can replace `upstream`
with the full URL instead.

```bash
git remote add upstream git@github.com:rust-lang/rust-clippy
```

This step is only necessary, if since the last release something was backported
to the beta Rust release. The remerge is then necessary, to make sure that the
Clippy commit, that was used by the now stable Rust release, persists in the
tree of the Clippy repository.
## Bump Version

To find out if this step is necessary run
When a release needs to be done, `cargo test` will fail, if the versions in the
`Cargo.toml` are not correct. During that sync, the versions need to be bumped.
This is done by running:

```bash
# Assumes that the local master branch of rust-lang/rust-clippy is up-to-date
$ git fetch upstream
$ git branch master --contains upstream/beta
cargo dev release bump_version
```

If this command outputs `master`, this step is **not** necessary.
This will increase the version number of each relevant `Cargo.toml` file. After
that, just commit the updated files with:

```bash
# Assuming `HEAD` is the current `master` branch of rust-lang/rust-clippy
$ git checkout -b backport_remerge
$ git merge upstream/beta
$ git diff # This diff has to be empty, otherwise something with the remerge failed
$ git push origin backport_remerge # This can be pushed to your fork
git commit -m "Bump Clippy version -> 0.1.XY" **/*Cargo.toml
```

After this, open a PR to the master branch. In this PR, the commit hash of the
`HEAD` of the `beta` branch must exist. In addition to that, no files should be
changed by this PR.
`XY` should be exchanged with the corresponding version

## Update the `beta` branch
## Find the Clippy commit

This step must be done **after** the PR of the previous step was merged.
For both updating the `beta` and the `stable` branch, the first step is to find
the Clippy commit of the last Clippy sync done in the respective Rust branch.

First, the Clippy commit of the `beta` branch of the Rust repository has to be
determined.
Running the following commands _in the Rust repo_ will get the commit for the
specified `<branch>`:

```bash
# Assuming the current directory corresponds to the Rust repository
$ git fetch upstream
$ git checkout upstream/beta
$ BETA_SHA=$(git log --oneline -- src/tools/clippy/ | grep -o "Merge commit '[a-f0-9]*' into .*" | head -1 | sed -e "s/Merge commit '\([a-f0-9]*\)' into .*/\1/g")
git switch <branch>
SHA=$(git log --oneline -- src/tools/clippy/ | grep -o "Merge commit '[a-f0-9]*' into .*" | head -1 | sed -e "s/Merge commit '\([a-f0-9]*\)' into .*/\1/g")
```

After finding the Clippy commit, the `beta` branch in the Clippy repository can
be updated.
Where `<branch>` is one of `stable`, `beta`, or `master`.

## Update the `beta` branch

After getting the commit of the `beta` branch, the `beta` branch in the Clippy
repository can be updated.

```bash
# Assuming the current directory corresponds to the Clippy repository
$ git checkout beta
$ git reset --hard $BETA_SHA
$ git push upstream beta
git checkout beta
git reset --hard $SHA
git push upstream beta
```

## Find the Clippy commit
## Update the `stable` branch

The first step is to tag the Clippy commit, that is included in the stable Rust
release. This commit can be found in the Rust repository.
After getting the commit of the `stable` branch, the `stable` branch in the
Clippy repository can be updated.

```bash
# Assuming the current directory corresponds to the Rust repository
$ git fetch upstream # `upstream` is the `rust-lang/rust` remote
$ git checkout 1.XX.0 # XX should be exchanged with the corresponding version
$ SHA=$(git log --oneline -- src/tools/clippy/ | grep -o "Merge commit '[a-f0-9]*' into .*" | head -1 | sed -e "s/Merge commit '\([a-f0-9]*\)' into .*/\1/g")
git checkout stable
git reset --hard $SHA
git push upstream stable
```

## Tag the stable commit
## Tag the `stable` commit

After finding the Clippy commit, it can be tagged with the release number.
After updating the `stable` branch, tag the HEAD commit and push it to the
Clippy repo.

> Note: Only push the tag once the Deploy GitHub action of the `beta` branch is
> finished. Otherwise the deploy for the tag might fail.

```bash
# Assuming the current directory corresponds to the Clippy repository
$ git checkout $SHA
$ git tag rust-1.XX.0 # XX should be exchanged with the corresponding version
$ git push upstream rust-1.XX.0 # `upstream` is the `rust-lang/rust-clippy` remote
git tag rust-1.XX.0 # XX should be exchanged with the corresponding version
git push upstream rust-1.XX.0 # `upstream` is the `rust-lang/rust-clippy` remote
```

After this, the release should be available on the Clippy [release page].

[release page]: https://github.com/rust-lang/rust-clippy/releases

## Update the `stable` branch
## Publish `clippy_utils`

The `clippy_utils` crate is published to `crates.io` without any stability
guarantees. To do this, after the [sync] and the release is done, switch back to
the `upstream/master` branch and publish `clippy_utils`:

At this step you should have already checked out the commit of the `rust-1.XX.0`
tag. Updating the stable branch from here is as easy as:
> Note: The Rustup PR bumping the nightly and Clippy version **must** be merged
> before doing this.

```bash
# Assuming the current directory corresponds to the Clippy repository and the
# commit of the just created rust-1.XX.0 tag is checked out.
$ git push upstream rust-1.XX.0:stable # `upstream` is the `rust-lang/rust-clippy` remote
git switch master && git pull upstream master
cargo publish --manifest-path clippy_utils/Cargo.toml
```

> _NOTE:_ Usually there are no stable backports for Clippy, so this update
> should be possible without force pushing or anything like this. If there
> should have happened a stable backport, make sure to re-merge those changes
> just as with the `beta` branch.
[sync]: sync.md

## Update `CHANGELOG.md`

Expand Down
Loading
Loading