mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-23 02:27:39 +03:00
fix ci/cd error
This commit is contained in:
@@ -262,12 +262,18 @@ fn is_expr_used_with_type_annotation<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx E
|
||||
/// Check if the expression is an associated function without a type instance.
|
||||
/// Example:
|
||||
/// ```
|
||||
/// Default::default()
|
||||
/// // Or
|
||||
/// trait Def {
|
||||
/// fn def() -> Self;
|
||||
/// fn def() -> Self;
|
||||
/// }
|
||||
/// impl Def for usize {
|
||||
/// fn def() -> Self {
|
||||
/// 0
|
||||
/// }
|
||||
/// }
|
||||
/// fn test() {
|
||||
/// let _ = 0usize + &Default::default();
|
||||
/// let _ = 0usize + &Def::def();
|
||||
/// }
|
||||
/// Def::def()
|
||||
/// ```
|
||||
fn is_assoc_fn_without_type_instance<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) -> bool {
|
||||
if let ExprKind::Call(func, _) = peel_hir_expr_refs(expr).0.kind
|
||||
|
||||
@@ -318,6 +318,9 @@ fn issue_14932() {
|
||||
|
||||
0usize + &Default::default(); // no error
|
||||
|
||||
<usize as Default>::default();
|
||||
//~^ identity_op
|
||||
|
||||
let _ = usize::default();
|
||||
//~^ identity_op
|
||||
|
||||
@@ -346,6 +349,9 @@ fn issue_14932_3() {
|
||||
|
||||
0usize + &Def::def(); // no error
|
||||
|
||||
<usize as Def>::def();
|
||||
//~^ identity_op
|
||||
|
||||
let _ = usize::def();
|
||||
//~^ identity_op
|
||||
|
||||
|
||||
@@ -318,6 +318,9 @@ fn issue_14932() {
|
||||
|
||||
0usize + &Default::default(); // no error
|
||||
|
||||
0usize + &<usize as Default>::default();
|
||||
//~^ identity_op
|
||||
|
||||
let _ = 0usize + &usize::default();
|
||||
//~^ identity_op
|
||||
|
||||
@@ -346,6 +349,9 @@ fn issue_14932_3() {
|
||||
|
||||
0usize + &Def::def(); // no error
|
||||
|
||||
0usize + &<usize as Def>::def();
|
||||
//~^ identity_op
|
||||
|
||||
let _ = 0usize + &usize::def();
|
||||
//~^ identity_op
|
||||
|
||||
|
||||
@@ -380,34 +380,46 @@ LL | let _: u64 = 1u64 + ((x as i32 + y as i32) as u64 + 0u64);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `((x as i32 + y as i32) as u64)`
|
||||
|
||||
error: this operation has no effect
|
||||
--> tests/ui/identity_op.rs:321:13
|
||||
--> tests/ui/identity_op.rs:321:5
|
||||
|
|
||||
LL | 0usize + &<usize as Default>::default();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `<usize as Default>::default()`
|
||||
|
||||
error: this operation has no effect
|
||||
--> tests/ui/identity_op.rs:324:13
|
||||
|
|
||||
LL | let _ = 0usize + &usize::default();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `usize::default()`
|
||||
|
||||
error: this operation has no effect
|
||||
--> tests/ui/identity_op.rs:324:21
|
||||
--> tests/ui/identity_op.rs:327:21
|
||||
|
|
||||
LL | let _n: usize = 0usize + &Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `Default::default()`
|
||||
|
||||
error: this operation has no effect
|
||||
--> tests/ui/identity_op.rs:330:5
|
||||
--> tests/ui/identity_op.rs:333:5
|
||||
|
|
||||
LL | 0usize + &Default::default()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `Default::default()`
|
||||
|
||||
error: this operation has no effect
|
||||
--> tests/ui/identity_op.rs:349:13
|
||||
--> tests/ui/identity_op.rs:352:5
|
||||
|
|
||||
LL | 0usize + &<usize as Def>::def();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `<usize as Def>::def()`
|
||||
|
||||
error: this operation has no effect
|
||||
--> tests/ui/identity_op.rs:355:13
|
||||
|
|
||||
LL | let _ = 0usize + &usize::def();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `usize::def()`
|
||||
|
||||
error: this operation has no effect
|
||||
--> tests/ui/identity_op.rs:352:21
|
||||
--> tests/ui/identity_op.rs:358:21
|
||||
|
|
||||
LL | let _n: usize = 0usize + &Def::def();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `Def::def()`
|
||||
|
||||
error: aborting due to 68 previous errors
|
||||
error: aborting due to 70 previous errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user