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

Update Clippy #114310

Merged
merged 148 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
148 commits
Select commit Hold shift click to select a range
648d1ae
lint on matches and pattern matching
y21 Jun 14, 2023
885ce61
New lint [`four_forward_slashes`]
Centri3 Jul 12, 2023
2e43d0c
Improve suggestion and add more tests
Centri3 Jul 13, 2023
c2aaa62
Fix ICE on None.unwrap_or_default()
syvb Jul 6, 2023
8d258c1
Add handling for None.unwrap_or(_else)
syvb Jul 6, 2023
fdb2e36
refactor(rustc_middle): Substs -> GenericArg
mdibaiee Jul 11, 2023
1f82f6d
[significant_drop_tightening] Fix #11160
c410-f3r Jul 14, 2023
f928d78
clippy-driver: Update bug URL to use the ice template
xFrednet Jul 16, 2023
eaccc6d
[`semicolon_if_nothing_returned`]: enable the autofix
sylvestre Jul 3, 2023
8ebdd62
[`semicolon_if_nothing_returned`]: Update the tests with the autofix
sylvestre Jul 4, 2023
9109533
Auto merge of #11168 - xFrednet:00000-free-ice-cream, r=flip1995
bors Jul 17, 2023
568ccf3
Auto merge of #11083 - sylvestre:autofix, r=dswij
bors Jul 17, 2023
d6d530f
Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyup
flip1995 Jul 17, 2023
2feb9a5
Another fix for incorrect_impls
flip1995 Jul 17, 2023
c388156
new lint: `format_collect`
y21 Jul 6, 2023
c83d58f
document that `write!`ing into a string never fails
y21 Jul 7, 2023
74a7704
Rewrite [`tuple_array_conversions`]
Centri3 Jul 17, 2023
36f84a6
Move tuple_array_conversions to nursery
Alexendoo Jul 17, 2023
54fa922
Auto merge of #11172 - Alexendoo:tuple-array-conversions-nursery, r=x…
bors Jul 17, 2023
d24f0d0
Don't lint `needless_return` in fns across a macro boundary
Alexendoo Jul 17, 2023
410456d
Auto merge of #11116 - y21:format_collect, r=Manishearth
bors Jul 17, 2023
3e0170b
Auto merge of #11173 - Alexendoo:needless-return-fn-macro, r=Manishearth
bors Jul 17, 2023
c26801e
[`redundant_pattern_matching`]: don't lint if if guards are present
y21 Jul 17, 2023
e7fd44f
add guard to suggestion instead of not linting
y21 Jul 17, 2023
d1e1dcb
Rename arg_iter to iter_instantiated
compiler-errors Jul 17, 2023
c13cb54
New lint `needless_return_with_try`
Centri3 Jun 26, 2023
747df85
Auto merge of #11171 - Centri3:tuple_array_conversions, r=llogiq
bors Jul 18, 2023
0d59d1d
Rename to `needless_return_with_question_mark`
Centri3 Jul 13, 2023
9f0cbfd
Auto merge of #11140 - Centri3:four_forward_slashes, r=blyxyas
bors Jul 18, 2023
75e1329
New lint [`error_impl_error`]
Centri3 Jul 4, 2023
f4b3bb1
Add `allow_private_error` config option
Centri3 Jul 7, 2023
9c6b17e
Remove `#![allow(unused)]` and `--crate-name` from new_lint tests
Alexendoo Jul 18, 2023
f539e1a
Remove unused flags from ui-cargo tests
Alexendoo Jul 18, 2023
8b0540b
Fix async functions handling for `needless_pass_by_ref_mut` lint
GuillaumeGomez Jul 18, 2023
5e9e462
Update `needless_pass_by_ref_mut` ui test
GuillaumeGomez Jul 18, 2023
d4a6634
Auto merge of #11175 - y21:issue11174, r=Manishearth
bors Jul 18, 2023
9d08502
New lint [`string_lit_chars_any`]
Centri3 Jun 30, 2023
ec57155
Auto merge of #11052 - Centri3:string_lit_chars_any, r=Jarcho
bors Jul 19, 2023
19b0e84
Remove the configuration option
Centri3 Jul 18, 2023
4c79d8a
new lint `iter_skip_zero`
Centri3 Jun 29, 2023
3dd6af9
Auto merge of #11046 - Centri3:iter_skip_zero, r=blyxyas
bors Jul 19, 2023
dcfc6a2
check for fully qualified paths in `unnecessary_cast`
Centri3 Jun 17, 2023
f583fd1
Fix `unwrap_or_else_default` false positive
smoelius Jul 9, 2023
0fa1fd3
Auto merge of #11183 - Alexendoo:new-lint-template, r=xFrednet
bors Jul 19, 2023
7a34143
Auto merge of #11135 - smoelius:unwrap_or_else_default-fp, r=Centri3
bors Jul 19, 2023
0b63e95
Auto merge of #10949 - y21:issue8010, r=Alexendoo
bors Jul 19, 2023
cbca8f9
On nightly, dump ICE backtraces to disk
estebank Mar 3, 2023
84c4112
Merge `unwrap_or_else_default.rs` into `or_fun_call.rs`
smoelius Jul 20, 2023
e27977b
Rename `unwrap_or_else_default` to `unwrap_or_default`
smoelius Jul 20, 2023
d71fbb9
Auto merge of #11107 - Centri3:error_impl_error, r=Jarcho
bors Jul 20, 2023
d764a0e
Auto merge of #11161 - c410-f3r:let-chain, r=dswij
bors Jul 20, 2023
579f1ec
Add Centri3 and blyxyas to the reviewer rotation
flip1995 Jul 20, 2023
15b68c2
Extract the logic for if a snippet equals a type
Centri3 Jun 29, 2023
0f31fff
Auto merge of #11194 - flip1995:new-reviewers, r=xFrednet
bors Jul 20, 2023
fbe292e
Auto merge of #10971 - Centri3:unnecessary_cast_fully_qual_fix, r=dswij
bors Jul 20, 2023
5a6c4d7
XSimplifiedType to SimplifiedType::X
lcnr Jul 18, 2023
f743fec
fix: false positive for `option_env!` in ifs
thvdveld Jul 20, 2023
fca1f9a
Auto merge of #11106 - syvb:literal_unwrap_ice, r=dswij
bors Jul 20, 2023
f0a16bb
[significant_drop_tightening] Fix #11189
c410-f3r Jul 20, 2023
7c5095c
Auto merge of #11195 - thvdveld:fix-option-env-ifs-equal-cond, r=Mani…
bors Jul 20, 2023
541d0c8
[`slow_vector_initialization`]: lint `Vec::new()`
y21 Jul 20, 2023
a4c367d
Allow `Self::cmp(self, other)` as a correct impl
Centri3 Jul 19, 2023
ee8a429
Auto merge of #11188 - Centri3:#11178, r=blyxyas
bors Jul 20, 2023
37b8366
[`unused_async`]: don't lint if paths reference async fn without call
y21 Jul 20, 2023
f3f7f63
[`inherent_to_string`]: Don't lint `unsafe` or `extern` fns
Centri3 Jul 21, 2023
d2c9047
Auto merge of #11205 - Centri3:#11201, r=Manishearth
bors Jul 21, 2023
9cf1509
New lint `absolute_paths`
Centri3 Jun 22, 2023
58df1e6
Auto merge of #11003 - Centri3:absolute_path, r=Alexendoo,blyxyas
bors Jul 21, 2023
008ba2b
new lint: redundant_local
max-niederman Jun 4, 2023
a44dcf8
Auto merge of #10885 - max-niederman:redundant_local, r=Centri3
bors Jul 22, 2023
da93ee8
Make `comparison_to_empty` work on `if let`/`let` chains
Centri3 Jun 26, 2023
ae5d391
Remove `LetChain`
Centri3 Jul 22, 2023
51b5772
new lint `redundant_guards`
Centri3 Jun 14, 2023
df3804a
Auto merge of #10955 - Centri3:redundant_matches_guard, r=Alexendoo,b…
bors Jul 22, 2023
482d5fa
replace HashMap with Vec, use span_lint_hir_and_then
y21 Jul 22, 2023
99202a0
Start addressing review comments
smoelius Jul 22, 2023
ea21ed7
Auto merge of #11196 - c410-f3r:let-chain, r=xFrednet
bors Jul 22, 2023
e8403a8
Auto merge of #11200 - y21:issue9695, r=Jarcho
bors Jul 22, 2023
356768b
Auto merge of #11029 - Centri3:empty_slice, r=Jarcho
bors Jul 23, 2023
55dd8a9
Refactor `dereference.rs`
Jarcho Jul 5, 2023
43577d5
Auto merge of #11184 - GuillaumeGomez:needless_pass_by_ref_mut-async,…
bors Jul 23, 2023
e975d05
check that the types are equal in `SpanlessEq::eq_expr`
y21 Jul 23, 2023
30d06a8
ptr_arg should ignore extern functions
mrnossiom Jul 23, 2023
a4e64ff
Auto merge of #11166 - Jarcho:expr_use, r=Centri3
bors Jul 23, 2023
5877504
Auto merge of #11214 - y21:issue11213, r=Jarcho
bors Jul 23, 2023
e4923c2
Auto merge of #10120 - smoelius:or_insert_with, r=blyxyas
bors Jul 23, 2023
7b8598d
ptr lint: check_mut_from_ref is checked independently of the function…
mrnossiom Jul 23, 2023
a447725
Auto merge of #11215 - MrNossiom:master, r=Jarcho
bors Jul 24, 2023
8298213
changelog: [`min_ident_chars`]: don't lint const generics
mrnossiom Jul 24, 2023
31f3769
Auto merge of #11031 - Centri3:needless_return, r=giraffate
bors Jul 24, 2023
5c26e82
Remove Gha status emitter in compile-test
Alexendoo Jul 23, 2023
867e0ec
Auto merge of #11218 - MrNossiom:master, r=Manishearth
bors Jul 24, 2023
ef482d1
Do not lint if used as a `fn`-like argument
Centri3 Jul 21, 2023
43b0e11
Auto merge of #11207 - Centri3:#11182, r=giraffate
bors Jul 25, 2023
d09c8a9
Auto merge of #11221 - Alexendoo:ui-test-text, r=flip1995
bors Jul 25, 2023
a147372
clippy: `env!` invocations can't be b"" literals
davidtwco Jul 25, 2023
2b16c37
bless more
RalfJung Jul 24, 2023
3fb714d
Use a builder instead of boolean/option arguments
oli-obk Jul 25, 2023
15de3dd
Add a note if the function is behind a cfg
GuillaumeGomez Jul 25, 2023
f20a174
Make everything builtin!
compiler-errors Jul 24, 2023
1fe2762
use a dedicated enum for vec initializer
y21 Jul 25, 2023
04b710b
Use libtest errors check to better enforce UI testing
GuillaumeGomez Jul 25, 2023
1c9772c
Move `inherits_cfg` function into clippy_utils
GuillaumeGomez Jul 25, 2023
c0484b7
simplify looking for `Vec::with_capacity` exprs
y21 Jul 25, 2023
2cc44cf
Auto merge of #113393 - compiler-errors:next-solver-unsize-rhs, r=lcnr
bors Jul 25, 2023
c3079a9
Fix integration tests
flip1995 Jun 17, 2023
0f3a149
Rollup merge of #114014 - davidtwco:issue-114010-env-rawstr, r=cjgillot
matthiaskrgr Jul 25, 2023
70c5798
Auto merge of #11198 - y21:issue10938, r=Centri3
bors Jul 25, 2023
12b63f5
ci: integration tests: print clippy run output and set LD_LIBRARY_PAT…
matthiaskrgr Jul 25, 2023
61e0aac
Auto merge of #114063 - matthiaskrgr:rollup-c90czu6, r=matthiaskrgr
bors Jul 25, 2023
2153c0f
Auto merge of #11226 - GuillaumeGomez:needless-ref-mut-cfg, r=llogiq
bors Jul 25, 2023
5976fda
Add *no merge policy* note via rustbot
xFrednet Jul 25, 2023
978b1da
New lint [`filter_map_bool_then`]
Centri3 Jul 6, 2023
3235d9d
Only lint `Copy` types
Centri3 Jul 16, 2023
90947e9
[`arc_with_non_send_sync`]: Check if it's macro-generated
Centri3 Jul 25, 2023
0404b6b
Add `sym::iter_mut` `sym::as_mut_ptr`
blyxyas Jul 25, 2023
0fec99f
Auto merge of #11115 - Centri3:filter_map_bool_then, r=Jarcho
bors Jul 26, 2023
0d0dbae
Auto merge of #11233 - Centri3:#11232, r=Jarcho
bors Jul 26, 2023
80641c0
Auto merge of #11231 - xFrednet:00000-merge-no-merge, r=flip1995
bors Jul 26, 2023
fc13bf8
Auto merge of #11225 - matthiaskrgr:fix_integration_tests2, r=flip1995
bors Jul 26, 2023
ed2ec81
Auto merge of #114054 - oli-obk:cleanups, r=estebank
bors Jul 26, 2023
01b9f9d
ci: test that we fail CI if we don't find clippy panicking
matthiaskrgr Jul 25, 2023
d446378
Auto merge of #11228 - matthiaskrgr:fix_integration_tests2__with_test…
bors Jul 26, 2023
4e1db44
Now `option_env_unwrap` warns even if a variable isn't set at compile…
blyxyas May 6, 2023
8615595
Rollup merge of #114070 - blyxyas:iter_mut_symbol, r=oli-obk
matthiaskrgr Jul 26, 2023
6ca6be6
Unite bless environment variables under `RUSTC_BLESS`
tgross35 Jul 3, 2023
3bfccac
Add comments Very minor Refactor
blyxyas Jul 26, 2023
42d3370
Auto merge of #113298 - tgross35:update-bless-envs, r=oli-obk
bors Jul 27, 2023
136339f
new lint: [`readonly_write_lock`]
y21 Jul 22, 2023
205a374
make lint description more consistent (writer/reader -> write/read)
y21 Jul 27, 2023
295bdc0
Auto merge of #10759 - blyxyas:unset_opt_env_unwrap, r=flip1995
bors Jul 27, 2023
5e88003
pattern match on local usage slice to avoid ICE
y21 Jul 28, 2023
d3c5b48
Auto merge of #11210 - y21:readonly_write_lock, r=giraffate
bors Jul 28, 2023
3d60241
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jul 28, 2023
65c5afd
Bump nightly version -> 2023-07-28
flip1995 Jul 28, 2023
2973096
Auto merge of #11250 - flip1995:rustup, r=flip1995
bors Jul 28, 2023
71cc39e
Add debug assertions to `implements_trait`
Jarcho Jul 30, 2023
4d80a2e
Rework `redundant_closure`
Jarcho Jul 30, 2023
7423c27
Don't lint redundant closure for any function call inserted by the co…
Jarcho Jun 9, 2023
4c2f460
Auto merge of #8685 - Jarcho:redundant_closure_fixes, r=llogiq
bors Jul 30, 2023
caf6014
Resolve type aliases in `type_certainty`
Jarcho Jul 30, 2023
c0bdb3d
Auto merge of #11258 - Jarcho:ice_11256, r=Centri3
bors Jul 30, 2023
008746c
[`unnecessary_find_map`]: look for then_some
y21 Jul 30, 2023
be6a103
add more tests to unnecessary_find_map and unnecessary_filter_map
y21 Jul 30, 2023
35d434d
[arithmetic_side_effects] Fix #11262
c410-f3r Jul 30, 2023
2ab1241
Auto merge of #11261 - y21:issue11260, r=blyxyas
bors Jul 30, 2023
5436dba
Auto merge of #11263 - c410-f3r:let-chain, r=Centri3
bors Jul 30, 2023
53f09d9
Merge commit '5436dba826191964ac1d0dab534b7eb6d4c878f6' into clippyup
flip1995 Jul 31, 2023
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
Prev Previous commit
Next Next commit
Fix ICE on None.unwrap_or_default()
  • Loading branch information
syvb committed Jul 13, 2023
commit c2aaa622eb1b8ce390dc5766199ed7c63d4900d7
12 changes: 12 additions & 0 deletions clippy_lints/src/methods/unnecessary_literal_unwrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 3,8 @@ use clippy_utils::{is_res_lang_ctor, last_path_segment, path_res, MaybePath};
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_middle::ty;
use rustc_middle::ty::print::with_forced_trimmed_paths;

use super::UNNECESSARY_LITERAL_UNWRAP;

Expand Down Expand Up @@ -84,6 86,16 @@ pub(super) fn check(
}
Some(suggs)
},
("None", "unwrap_or_default", _) => {
let ty = cx.typeck_results().expr_ty(expr);
let default_ty_string = if let ty::Adt(def, ..) = ty.kind() {
with_forced_trimmed_paths!(format!("{}", cx.tcx.def_path_str(def.did())))
} else {
"Default".to_string()
};
Some(vec![(expr.span, format!("{default_ty_string}::default()"))])
},
_ if call_args.is_empty() => None,
(_, _, Some(_)) => None,
("Ok", "unwrap_err", None) | ("Err", "unwrap", None) => Some(vec![
(
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/unnecessary_literal_unwrap.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 19,11 @@ fn unwrap_option_some() {
fn unwrap_option_none() {
let _val = panic!();
let _val = panic!("this always happens");
let _val: String = String::default();

panic!();
panic!("this always happens");
String::default();
}

fn unwrap_result_ok() {
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/unnecessary_literal_unwrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 19,11 @@ fn unwrap_option_some() {
fn unwrap_option_none() {
let _val = None::<()>.unwrap();
let _val = None::<()>.expect("this always happens");
let _val: String = None.unwrap_or_default();

None::<()>.unwrap();
None::<()>.expect("this always happens");
None::<String>.unwrap_or_default();
}

fn unwrap_result_ok() {
Expand Down
Loading