Skip to content

Commit 9d1b210

Browse files
committed
Auto merge of #94265 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.59.0 artifacts (second round) This backports (from 1.60, landed in #93001): * Move return_self_not_must_use to pedantic rust-lang/rust-clippy#8302 Per a user report on the internals feedback thread, this lint is not behaving well in 1.59. cc `@rust-lang/clippy` -- this is a stable backport of a patch, which we'll likely want to land in fairly short order to be in time for the release Thursday. This PR also includes an adjustment to the release notes to reflect "Fix invalid special casing of the unreachable! macro #93179". r? `@Mark-Simulacrum`
2 parents 3a06854 + 6bd1b5f commit 9d1b210

7 files changed

+7
-6
lines changed

RELEASES.md

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Compatibility Notes
101101
- [Weaken guarantee around advancing underlying iterators in zip][83791]
102102
- [Make split_inclusive() on an empty slice yield an empty output][89825]
103103
- [Update std::env::temp_dir to use GetTempPath2 on Windows when available.][89999]
104+
- [unreachable! was updated to match other formatting macro behavior on Rust 2021][92137]
104105

105106
Internal Changes
106107
----------------

src/tools/clippy/clippy_lints/src/lib.register_all.rs

-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
247247
LintId::of(reference::REF_IN_DEREF),
248248
LintId::of(regex::INVALID_REGEX),
249249
LintId::of(repeat_once::REPEAT_ONCE),
250-
LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE),
251250
LintId::of(returns::LET_AND_RETURN),
252251
LintId::of(returns::NEEDLESS_RETURN),
253252
LintId::of(self_assignment::SELF_ASSIGNMENT),

src/tools/clippy/clippy_lints/src/lib.register_pedantic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
8080
LintId::of(ranges::RANGE_PLUS_ONE),
8181
LintId::of(redundant_else::REDUNDANT_ELSE),
8282
LintId::of(ref_option_ref::REF_OPTION_REF),
83+
LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE),
8384
LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED),
8485
LintId::of(strings::STRING_ADD_ASSIGN),
8586
LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS),

src/tools/clippy/clippy_lints/src/lib.register_suspicious.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), vec!
1616
LintId::of(methods::SUSPICIOUS_MAP),
1717
LintId::of(mut_key::MUTABLE_KEY_TYPE),
1818
LintId::of(octal_escapes::OCTAL_ESCAPES),
19-
LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE),
2019
LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
2120
LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
2221
])

src/tools/clippy/clippy_lints/src/return_self_not_must_use.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ declare_clippy_lint! {
3838
/// ```
3939
#[clippy::version = "1.59.0"]
4040
pub RETURN_SELF_NOT_MUST_USE,
41-
suspicious,
41+
pedantic,
4242
"missing `#[must_use]` annotation on a method returning `Self`"
4343
}
4444

src/tools/clippy/tests/ui/return_self_not_must_use.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![crate_type = "lib"]
2+
#![warn(clippy::return_self_not_must_use)]
23

34
#[derive(Clone)]
45
pub struct Bar;

src/tools/clippy/tests/ui/return_self_not_must_use.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error: missing `#[must_use]` attribute on a method returning `Self`
2-
--> $DIR/return_self_not_must_use.rs:7:5
2+
--> $DIR/return_self_not_must_use.rs:8:5
33
|
44
LL | fn what(&self) -> Self;
55
| ^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::return-self-not-must-use` implied by `-D warnings`
88

99
error: missing `#[must_use]` attribute on a method returning `Self`
10-
--> $DIR/return_self_not_must_use.rs:17:5
10+
--> $DIR/return_self_not_must_use.rs:18:5
1111
|
1212
LL | / pub fn foo(&self) -> Self {
1313
LL | | Self
1414
LL | | }
1515
| |_____^
1616

1717
error: missing `#[must_use]` attribute on a method returning `Self`
18-
--> $DIR/return_self_not_must_use.rs:20:5
18+
--> $DIR/return_self_not_must_use.rs:21:5
1919
|
2020
LL | / pub fn bar(self) -> Self {
2121
LL | | self

0 commit comments

Comments
 (0)