Skip to content

Commit e4e6c76

Browse files
committed
Fix josh sync fallout
1 parent a0d16a1 commit e4e6c76

9 files changed

+25
-31
lines changed

clippy_lints/src/from_over_into.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ fn convert_to_from(
181181
let from = snippet_opt(cx, self_ty.span)?;
182182
let into = snippet_opt(cx, target_ty.span)?;
183183

184+
let return_type = matches!(sig.decl.output, FnRetTy::Return(_))
185+
.then_some(String::from("Self"))
186+
.unwrap_or_default();
184187
let mut suggestions = vec![
185188
// impl Into<T> for U -> impl From<T> for U
186189
// ~~~~ ~~~~
@@ -197,13 +200,10 @@ fn convert_to_from(
197200
// fn into([mut] self) -> T -> fn into([mut] v: T) -> T
198201
// ~~~~ ~~~~
199202
(self_ident.span, format!("val: {from}")),
200-
];
201-
202-
if let FnRetTy::Return(_) = sig.decl.output {
203203
// fn into(self) -> T -> fn into(self) -> Self
204204
// ~ ~~~~
205-
suggestions.push((sig.decl.output.span(), String::from("Self")));
206-
}
205+
(sig.decl.output.span(), return_type),
206+
];
207207

208208
let mut finder = SelfFinder {
209209
cx,

clippy_lints/src/mutable_debug_assertion.rs

-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ impl<'a, 'tcx> Visitor<'tcx> for MutArgVisitor<'a, 'tcx> {
9696
self.found = true;
9797
return;
9898
},
99-
ExprKind::If(..) => {
100-
self.found = true;
101-
return;
102-
},
10399
ExprKind::Path(_) => {
104100
if let Some(adj) = self.cx.typeck_results().adjustments().get(expr.hir_id) {
105101
if adj

clippy_utils/src/source.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_hir::{BlockCheckMode, Expr, ExprKind, UnsafeSource};
88
use rustc_lint::{LateContext, LintContext};
99
use rustc_session::Session;
1010
use rustc_span::source_map::{original_sp, SourceMap};
11-
use rustc_span::{hygiene, BytePos, SourceFileAndLine, Pos, SourceFile, Span, SpanData, SyntaxContext, DUMMY_SP};
11+
use rustc_span::{hygiene, BytePos, Pos, SourceFile, SourceFileAndLine, Span, SpanData, SyntaxContext, DUMMY_SP};
1212
use std::borrow::Cow;
1313
use std::ops::Range;
1414

tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ LL | const DEREF_MUT_TRAIT: [&str; 4] = ["core", "ops", "deref", "DerefMut"]
1919
error: hardcoded path to a diagnostic item
2020
--> tests/ui-internal/unnecessary_def_path_hardcoded_path.rs:12:43
2121
|
22-
LL | const OPS_MOD: [&str; 5] = ["core", "ops"];
23-
| ^^^^^^^^^^^^^^^
22+
LL | const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"];
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424
|
2525
= help: convert all references to use `sym::deref_method`
2626

tests/ui/derive.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![allow(clippy::non_canonical_clone_impl, clippy::non_canonical_partial_ord_impl, dead_code)]
22
#![warn(clippy::expl_impl_clone_on_copy)]
33

4-
54
#[derive(Copy)]
65
struct Qux;
76

tests/ui/derive.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: you are implementing `Clone` explicitly on a `Copy` type
2-
--> tests/ui/derive.rs:8:1
2+
--> tests/ui/derive.rs:7:1
33
|
44
LL | / impl Clone for Qux {
55
LL | |
@@ -10,7 +10,7 @@ LL | | }
1010
| |_^
1111
|
1212
note: consider deriving `Clone` or removing `Copy`
13-
--> tests/ui/derive.rs:8:1
13+
--> tests/ui/derive.rs:7:1
1414
|
1515
LL | / impl Clone for Qux {
1616
LL | |
@@ -23,7 +23,7 @@ LL | | }
2323
= help: to override `-D warnings` add `#[allow(clippy::expl_impl_clone_on_copy)]`
2424

2525
error: you are implementing `Clone` explicitly on a `Copy` type
26-
--> tests/ui/derive.rs:33:1
26+
--> tests/ui/derive.rs:32:1
2727
|
2828
LL | / impl<'a> Clone for Lt<'a> {
2929
LL | |
@@ -34,7 +34,7 @@ LL | | }
3434
| |_^
3535
|
3636
note: consider deriving `Clone` or removing `Copy`
37-
--> tests/ui/derive.rs:33:1
37+
--> tests/ui/derive.rs:32:1
3838
|
3939
LL | / impl<'a> Clone for Lt<'a> {
4040
LL | |
@@ -45,7 +45,7 @@ LL | | }
4545
| |_^
4646

4747
error: you are implementing `Clone` explicitly on a `Copy` type
48-
--> tests/ui/derive.rs:45:1
48+
--> tests/ui/derive.rs:44:1
4949
|
5050
LL | / impl Clone for BigArray {
5151
LL | |
@@ -56,7 +56,7 @@ LL | | }
5656
| |_^
5757
|
5858
note: consider deriving `Clone` or removing `Copy`
59-
--> tests/ui/derive.rs:45:1
59+
--> tests/ui/derive.rs:44:1
6060
|
6161
LL | / impl Clone for BigArray {
6262
LL | |
@@ -67,7 +67,7 @@ LL | | }
6767
| |_^
6868

6969
error: you are implementing `Clone` explicitly on a `Copy` type
70-
--> tests/ui/derive.rs:57:1
70+
--> tests/ui/derive.rs:56:1
7171
|
7272
LL | / impl Clone for FnPtr {
7373
LL | |
@@ -78,7 +78,7 @@ LL | | }
7878
| |_^
7979
|
8080
note: consider deriving `Clone` or removing `Copy`
81-
--> tests/ui/derive.rs:57:1
81+
--> tests/ui/derive.rs:56:1
8282
|
8383
LL | / impl Clone for FnPtr {
8484
LL | |
@@ -89,7 +89,7 @@ LL | | }
8989
| |_^
9090

9191
error: you are implementing `Clone` explicitly on a `Copy` type
92-
--> tests/ui/derive.rs:78:1
92+
--> tests/ui/derive.rs:77:1
9393
|
9494
LL | / impl<T: Clone> Clone for Generic2<T> {
9595
LL | |
@@ -100,7 +100,7 @@ LL | | }
100100
| |_^
101101
|
102102
note: consider deriving `Clone` or removing `Copy`
103-
--> tests/ui/derive.rs:78:1
103+
--> tests/ui/derive.rs:77:1
104104
|
105105
LL | / impl<T: Clone> Clone for Generic2<T> {
106106
LL | |

tests/ui/needless_doc_main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010
/// unimplemented!();
1111
/// }
1212
/// ```
13-
///
13+
///
1414
/// With an explicit return type it should lint too
1515
/// ```edition2015
1616
/// fn main() -> () {
1717
//~^ ERROR: needless `fn main` in doctest
1818
/// unimplemented!();
1919
/// }
2020
/// ```
21-
///
21+
///
2222
/// This should, too.
2323
/// ```rust
2424
/// fn main() {
2525
//~^ ERROR: needless `fn main` in doctest
2626
/// unimplemented!();
2727
/// }
2828
/// ```
29-
///
29+
///
3030
/// This one too.
3131
/// ```no_run
3232
/// // the fn is not always the first line

tests/ui/temporary_assignment.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![warn(clippy::temporary_assignment)]
2-
#![allow(const_item_mutation)]
32

43
use std::ops::{Deref, DerefMut};
54

tests/ui/temporary_assignment.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: assignment to temporary
2-
--> tests/ui/temporary_assignment.rs:48:5
2+
--> tests/ui/temporary_assignment.rs:47:5
33
|
44
LL | Struct { field: 0 }.field = 1;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | Struct { field: 0 }.field = 1;
88
= help: to override `-D warnings` add `#[allow(clippy::temporary_assignment)]`
99

1010
error: assignment to temporary
11-
--> tests/ui/temporary_assignment.rs:51:5
11+
--> tests/ui/temporary_assignment.rs:50:5
1212
|
1313
LL | / MultiStruct {
1414
LL | |
@@ -19,13 +19,13 @@ LL | | .field = 1;
1919
| |______________^
2020

2121
error: assignment to temporary
22-
--> tests/ui/temporary_assignment.rs:57:5
22+
--> tests/ui/temporary_assignment.rs:56:5
2323
|
2424
LL | ArrayStruct { array: [0] }.array[0] = 1;
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2626

2727
error: assignment to temporary
28-
--> tests/ui/temporary_assignment.rs:59:5
28+
--> tests/ui/temporary_assignment.rs:58:5
2929
|
3030
LL | (0, 0).0 = 1;
3131
| ^^^^^^^^^^^^

0 commit comments

Comments
 (0)