about summary refs log tree commit diff
path: root/clippy_lints/src/no_effect.rs
AgeCommit message (Collapse)AuthorLines
2025-02-02Convert two `rustc_middle::lint` functions to `Span` methods.Nicholas Nethercote-2/+1
`rustc_middle` is a huge crate and it's always good to move stuff out of it. There are lots of similar methods already on `Span`, so these two functions, `in_external_macro` and `is_from_async_await`, fit right in. The diff is big because `in_external_macro` is used a lot by clippy lints.
2025-01-09Merge commit '19e305bb57a7595f2a8d81f521c0dd8bf854e739' into ↵Philipp Krones-1/+1
clippy-subtree-update
2025-01-04turn hir::ItemKind::Fn into a named-field variantRalf Jung-1/+1
2024-12-26Merge commit '609cd310be44677ae31d452a17b0f8207e1abfe1' into ↵Philipp Krones-1/+1
clippy-subtree-update
2024-12-09Introduce `default_field_values` featureEsteban Küber-2/+9
Initial implementation of `#[feature(default_field_values]`, proposed in https://github.com/rust-lang/rfcs/pull/3681. Support default fields in enum struct variant Allow default values in an enum struct variant definition: ```rust pub enum Bar { Foo { bar: S = S, baz: i32 = 42 + 3, } } ``` Allow using `..` without a base on an enum struct variant ```rust Bar::Foo { .. } ``` `#[derive(Default)]` doesn't account for these as it is still gating `#[default]` only being allowed on unit variants. Support `#[derive(Default)]` on enum struct variants with all defaulted fields ```rust pub enum Bar { #[default] Foo { bar: S = S, baz: i32 = 42 + 3, } } ``` Check for missing fields in typeck instead of mir_build. Expand test with `const` param case (needs `generic_const_exprs` enabled). Properly instantiate MIR const The following works: ```rust struct S<A> { a: Vec<A> = Vec::new(), } S::<i32> { .. } ``` Add lint for default fields that will always fail const-eval We *allow* this to happen for API writers that might want to rely on users' getting a compile error when using the default field, different to the error that they would get when the field isn't default. We could change this to *always* error instead of being a lint, if we wanted. This will *not* catch errors for partially evaluated consts, like when the expression relies on a const parameter. Suggestions when encountering `Foo { .. }` without `#[feature(default_field_values)]`: - Suggest adding a base expression if there are missing fields. - Suggest enabling the feature if all the missing fields have optional values. - Suggest removing `..` if there are no missing fields.
2024-11-28Merge commit 'ff4a26d442bead94a4c96fb1de967374bc4fbd8e' into ↵Philipp Krones-1/+1
clippy-subtree-update
2024-11-07Merge commit 'f712eb5cdccd121d0569af12f20e6a0fabe4364d' into ↵Philipp Krones-2/+6
clippy-subtree-update
2024-10-29update toolslcnr-1/+1
2024-09-24Merge commit '7901289135257ca0fbed3a5522526f95b0f5edba' into ↵Philipp Krones-2/+2
clippy-subtree-update
2024-08-24Merge commit '0f8eabd6231366bfc1bb1464601297c2d48f8f68' into clippyupJason Newcomb-25/+22
2024-08-08Merge commit 'cb806113e0f83a8f9b47d35b453b676543bcc40e' into ↵Philipp Krones-1/+1
clippy-subtree-update
2024-07-21Fix toolsMichael Goulet-1/+2
2024-07-11Merge commit 'b794b8e08c16517a941dc598bb1483e8e12a8592' into ↵Philipp Krones-3/+8
clippy-subtree-update
2024-05-21Merge commit '2efebd2f0c03dabbe5c3ad7b4ebfbd99238d1fb2' into ↵Philipp Krones-3/+5
clippy-subtree-update
2024-04-04Merge commit '9725c4a162502a02c1c67fdca6b797fe09b2b73c' into ↵Philipp Krones-1/+1
clippy-subtree-update
2024-03-14Rename `hir::StmtKind::Local` into `hir::StmtKind::Let`Guillaume Gomez-1/+1
2024-02-27Merge commit '10136170fe9ed01e46aeb4f4479175b79eb0e3c7' into ↵Philipp Krones-8/+5
clippy-subtree-update
2024-02-13Bump `indexmap`clubby789-2/+4
`swap` has been deprecated in favour of `swap_remove` - the behaviour is the same though.
2024-02-08Merge commit '60cb29c5e4f9772685c9873752196725c946a849' into clippyupPhilipp Krones-1/+1
2024-01-25Merge commit '66c29b973b3b10278bd39f4e26b08522a379c2c9' into ↵Philipp Krones-73/+106
clippy-subtree-update
2024-01-11Merge commit '26ac6aab023393c94edf42f38f6ad31196009643'Philipp Krones-1/+1
2023-12-16Merge commit 'a859e5cc1ce100df22346a1005da30532d04de59' into clippyupPhilipp Krones-4/+30
2023-12-01Merge commit 'f0cdee4a3f094416189261481eae374b76792af1' into clippy-subtree-syncPhilipp Krones-1/+1
2023-11-16Merge commit 'edb720b199083f4107b858a8761648065bf38d86' into clippyupPhilipp Krones-69/+64
2023-11-02Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyupPhilipp Krones-4/+9
2023-09-25Merge commit '7671c283a50b5d1168841f3014b14000f01dd204' into clippyupPhilipp Krones-7/+4
2023-08-04Improve spans for indexing expressionsNilstrieb-2/+2
Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.
2023-07-17Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyupPhilipp Krones-2/+1
2023-07-02Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyupPhilipp Krones-3/+44
2023-03-14Remove box expressions from HIRclubby789-4/+2
2022-12-01Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyupPhilipp Krones-2/+6
2022-07-11move else block into the `Local` structDing Xiang Fei-2/+2
2022-07-11lower let-else in MIR insteadDing Xiang Fei-1/+2
2022-06-12Make `ExprKind::Closure` a struct variant.Camille GILLOT-1/+1
2022-01-13Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyupflip1995-2/+2
2021-12-17Merge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyupflip1995-4/+2
2021-12-06Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyupflip1995-6/+17
2021-10-21Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyupflip1995-64/+115
2021-09-08Merge commit '27afd6ade4bb1123a8bf82001629b69d23d62aff' into clippyupflip1995-17/+52
2021-08-12Merge commit '7bfc26ec8e7a454786668e7e52ffe527fc649735' into clippyupflip1995-7/+9
2021-07-29Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyupflip1995-10/+10
2021-07-01Merge commit '61eb38aeda6cb54b93b872bf503d70084c4d621c' into clippyupflip1995-1/+1
2021-06-03Merge commit '3ae8faff4d46ad92f194c2a4b941c3152a701b31' into clippyupflip1995-6/+7
2021-04-08Merge commit 'b40ea209e7f14c8193ddfc98143967b6a2f4f5c9' into clippyupflip1995-30/+28
2021-03-25Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyupflip1995-1/+3
2021-01-18Remove qpath_res util functionCameron Steffen-3/+3
2020-07-17Rename TypeckTables to TypeckResults.Valentin Lazureanu-5/+6
2020-07-03Use 'tcx for references to AccessLevels wherever possible.Eduard-Mihai Burtescu-4/+4
2020-06-26rustc_lint: only query `typeck_tables_of` when a lint needs it.Eduard-Mihai Burtescu-5/+5
2020-06-09Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippyLzu Tao-1/+1