Skip to content

Commit 67ec96c

Browse files
committed
Auto merge of #5691 - flip1995:rustup, r=matthiaskrgr
Rustup changelog: none
2 parents 5699672 + d9aa26a commit 67ec96c

File tree

7 files changed

+28
-10
lines changed

7 files changed

+28
-10
lines changed

.github/workflows/clippy_bors.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ jobs:
232232
matrix:
233233
integration:
234234
- 'rust-lang/cargo'
235-
- 'rust-lang/rls'
235+
# FIXME: re-enable once fmt_macros is renamed in RLS
236+
# - 'rust-lang/rls'
236237
- 'rust-lang/chalk'
237238
- 'rust-lang/rustfmt'
238239
- 'Marwes/combine'

clippy_lints/src/future_not_send.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FutureNotSend {
9595
let trait_ref = trait_pred.to_poly_trait_ref();
9696
db.note(&*format!(
9797
"`{}` doesn't implement `{}`",
98-
trait_ref.self_ty(),
98+
trait_ref.skip_binder().self_ty(),
9999
trait_ref.print_only_trait_path(),
100100
));
101101
}

clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
// FIXME: switch to something more ergonomic here, once available.
1717
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
1818
#[allow(unused_extern_crates)]
19-
extern crate fmt_macros;
20-
#[allow(unused_extern_crates)]
2119
extern crate rustc_ast;
2220
#[allow(unused_extern_crates)]
2321
extern crate rustc_ast_pretty;
@@ -48,6 +46,8 @@ extern crate rustc_mir;
4846
#[allow(unused_extern_crates)]
4947
extern crate rustc_parse;
5048
#[allow(unused_extern_crates)]
49+
extern crate rustc_parse_format;
50+
#[allow(unused_extern_crates)]
5151
extern crate rustc_session;
5252
#[allow(unused_extern_crates)]
5353
extern crate rustc_span;

clippy_lints/src/utils/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ pub fn implements_trait<'a, 'tcx>(
325325
trait_id: DefId,
326326
ty_params: &[GenericArg<'tcx>],
327327
) -> bool {
328+
// Do not check on infer_types to avoid panic in evaluate_obligation.
329+
if ty.has_infer_types() {
330+
return false;
331+
}
332+
let ty = cx.tcx.erase_regions(&ty);
328333
let ty_params = cx.tcx.mk_substs(ty_params.iter());
329334
cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env))
330335
}

clippy_lints/src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ impl Write {
369369
tts: &TokenStream,
370370
is_write: bool,
371371
) -> (Option<StrLit>, Option<Expr>) {
372-
use fmt_macros::{
372+
use rustc_parse_format::{
373373
AlignUnknown, ArgumentImplicitlyIs, ArgumentIs, ArgumentNamed, CountImplied, FormatSpec, ParseMode, Parser,
374374
Piece,
375375
};

tests/ui/or_fun_call.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn or_fun_call() {
2929
with_enum.unwrap_or(Enum::A(5));
3030

3131
let with_const_fn = Some(Duration::from_secs(1));
32-
with_const_fn.unwrap_or(Duration::from_secs(5));
32+
with_const_fn.unwrap_or_else(|| Duration::from_secs(5));
3333

3434
let with_constructor = Some(vec![1]);
3535
with_constructor.unwrap_or_else(make);
@@ -94,7 +94,7 @@ fn test_or_with_ctors() {
9494

9595
let b = "b".to_string();
9696
let _ = Some(Bar("a".to_string(), Duration::from_secs(1)))
97-
.or(Some(Bar(b, Duration::from_secs(2))));
97+
.or_else(|| Some(Bar(b, Duration::from_secs(2))));
9898

9999
let vec = vec!["foo"];
100100
let _ = opt.ok_or(vec.len());

tests/ui/or_fun_call.stderr

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
error: use of `unwrap_or` followed by a function call
2+
--> $DIR/or_fun_call.rs:32:19
3+
|
4+
LL | with_const_fn.unwrap_or(Duration::from_secs(5));
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Duration::from_secs(5))`
6+
|
7+
= note: `-D clippy::or-fun-call` implied by `-D warnings`
8+
19
error: use of `unwrap_or` followed by a function call
210
--> $DIR/or_fun_call.rs:35:22
311
|
412
LL | with_constructor.unwrap_or(make());
513
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
6-
|
7-
= note: `-D clippy::or-fun-call` implied by `-D warnings`
814

915
error: use of `unwrap_or` followed by a call to `new`
1016
--> $DIR/or_fun_call.rs:38:5
@@ -78,5 +84,11 @@ error: use of `or` followed by a function call
7884
LL | let _ = Some("a".to_string()).or(Some("b".to_string()));
7985
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_else(|| Some("b".to_string()))`
8086

81-
error: aborting due to 13 previous errors
87+
error: use of `or` followed by a function call
88+
--> $DIR/or_fun_call.rs:97:10
89+
|
90+
LL | .or(Some(Bar(b, Duration::from_secs(2))));
91+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_else(|| Some(Bar(b, Duration::from_secs(2))))`
92+
93+
error: aborting due to 15 previous errors
8294

0 commit comments

Comments
 (0)