Jason Newcomb
9e50049157
Split possible_missing_else from suspicious_else_formatting.
2025-07-20 10:21:18 -04:00
Samuel Tardieu
79c69112dc
Apply collapsible_if to Clippy itself
...
Since Clippy uses the `let_chains` feature, there are many occasions to
collapse `if` and `if let` statements.
2025-03-27 14:40:44 +01:00
Nicholas Nethercote
d30f045fce
Convert two rustc_middle::lint functions to Span methods.
...
`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-02-02 13:57:34 +11:00
Philipp Krones
0ae4a048c6
Merge commit ' 9725c4a162' into clippy-subtree-update
2024-04-04 19:52:55 +02:00
Philipp Krones
c9a43b18f1
Merge commit ' f0cdee4a3f' into clippy-subtree-sync
2023-12-01 18:21:58 +01:00
Nicholas Nethercote
684c4bfef1
Rework ast::BinOpKind::to_string and ast::UnOp::to_string.
...
- Rename them both `as_str`, which is the typical name for a function
that returns a `&str`. (`to_string` is appropriate for functions
returning `String` or maybe `Cow<'a, str>`.)
- Change `UnOp::as_str` from an associated function (weird!) to a
method.
- Avoid needless `self` dereferences.
2023-11-28 09:42:07 +11:00
Philipp Krones
6246f0446a
Merge commit ' edb720b199' into clippyup
2023-11-16 19:13:24 +01:00
bors
2d9af160af
Auto merge of #117507 - nnethercote:rustc_span, r=Nilstrieb
...
`rustc_span` cleanups
Just some things I found while looking over this crate.
r? `@oli-obk`
2023-11-03 14:57:40 +00:00
Philipp Krones
77c1e3aaa1
Merge commit ' 09ac14c901' into clippyup
2023-11-02 17:35:56 +01:00
Nicholas Nethercote
e1ec2d5cc9
Minimize pub usage in source_map.rs.
...
Most notably, this commit changes the `pub use crate::*;` in that file
to `use crate::*;`. This requires a lot of `use` items in other crates
to be adjusted, because everything defined within `rustc_span::*` was
also available via `rustc_span::source_map::*`, which is bizarre.
The commit also removes `SourceMap::span_to_relative_line_string`, which
is unused.
2023-11-02 19:35:00 +11:00
Arthur Lafrance
9ee26d078d
fix lint failures in clippy
2023-10-16 19:50:31 -07:00
Philipp Krones
cb3ecf7b79
Merge commit ' 37f4c1725d' into clippyup
2023-07-02 14:59:02 +02:00
Philipp Krones
a1b75c5108
Merge commit ' a3ed905928' into clippyup
2023-04-23 13:28:56 +02:00
Philipp Krones
d75b25faab
Merge commit ' ac0e10aa68' into clippyup
2022-10-06 09:44:38 +02:00
Philipp Krones
dc29cfb8d5
Merge commit ' 2b2190cb56' into clippyup
2022-08-11 19:42:16 +02:00
Philipp Krones
f067783461
Merge commit ' d9ddce8a22' into clippyup
2022-06-04 13:34:07 +02:00
flip1995
611d039814
Merge commit ' 57b3c4b90f' into clippyup
2022-02-10 18:40:06 +01:00
Vadim Petrochenkov
aee89cdff1
Update clippy
2022-01-23 19:31:32 +08:00
flip1995
8fea1d94f3
Merge commit ' a5d597637d' into clippyup
2021-12-06 12:33:31 +01:00
flip1995
23d5457e6d
Merge commit ' cb7915b00c' into clippyup
2021-09-28 18:03:12 +01:00
Frank Steffahn
21da42ce29
Fix more “a”/“an” typos
2021-08-22 17:27:18 +02:00
flip1995
2b20f49841
Merge commit ' 0cce3f643b' into clippyup
2021-07-29 12:16:06 +02:00
flip1995
ebe52869a3
Merge commit ' 61eb38aeda' into clippyup
2021-07-01 18:17:38 +02:00
flip1995
02bf692169
Merge commit ' 98e2b9f25b' into clippyup
2021-04-22 11:31:13 +02:00
flip1995
f6d1f368db
Merge commit ' b40ea209e7' into clippyup
2021-04-08 17:50:13 +02:00
flip1995
9f6b5de7de
Merge commit ' 0e87918536' into clippyup
2021-03-25 19:29:11 +01:00
flip1995
6f25adbd5a
Merge commit ' 2ca58e7dda' into clippyup
2020-07-14 14:59:59 +02:00
Lzu Tao
8db24840f7
Merge commit ' ff0993c5e9' into clippy
2020-06-09 14:36:01 +00:00
xiongmao86
d7f1a1ed2b
Change note_span argument for span_lint_and_note.
2020-04-18 18:29:36 +08:00
xiongmao86
cf4e35339b
Add an Option<Span> argument to span_lint_and_help.
2020-04-18 18:28:29 +08:00
Matthias Krüger
aff57e0f43
rustup https://github.com/rust-lang/rust/pull/70536
2020-03-30 11:17:58 +02:00
Yuki Okushi
4253aa7137
Rustup to rust-lang/rust#69592
2020-03-01 12:23:33 +09:00
flip1995
8472ecda0f
Fix fallout
2020-02-21 11:14:18 +01:00
Yuki Okushi
f5e86d6894
Rename span_note_and_lint to span_lint_and_note
2020-01-27 11:26:42 +09:00
Yuki Okushi
f60f12f71f
Rename span_help_and_lint to span_lint_and_help
2020-01-27 11:17:58 +09:00
Mikhail Babenko
a234aef084
dont fire possible_missing_comma if intendation is present
2020-01-25 20:16:05 +03:00
Yuki Okushi
ce1c6b285d
Rustup to rust-lang/rust#68045
2020-01-13 21:55:57 +09:00
Yuki Okushi
39947992b5
Rustup to rust-lang/rust#67806
2020-01-11 21:50:00 +09:00
Lzu Tao
652666b288
rustup "Add span information to ExprKind::Assign"
2019-12-24 11:25:24 +07:00
Matthias Krüger
98e433d70d
Rustup to rust-lang/rust#66878
2019-12-04 01:34:01 +01:00
Andre Bogus
cc622608db
new lints around #[must_use] fns
...
`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.
`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.
`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.
2019-10-14 12:09:04 +02:00
Nikos Filippakis
5143fe1a78
New lint: suspicious_unary_op_formatting
...
Lints when, on the RHS of a BinOp, there is a UnOp without a space
before the operator but with a space after (e.g. foo >- 1).
Signed-off-by: Nikos Filippakis <nikolaos.filippakis@cern.ch>
2019-10-09 16:22:00 +02:00
flip1995
4bbd10a585
Rustup to rust-lang/rust#64813
2019-09-27 17:21:20 +02:00
KRAAI, MATTHEW [VISUS]
204b2f3658
Remove in_macro_or_desugar
2019-08-19 09:30:32 -07:00
flip1995
662037bcf2
Simplify unsugar_if to just an if expr check
2019-06-24 09:51:53 +02:00
flip1995
c192c07930
Remove ast:: prefix from types
2019-06-24 09:40:11 +02:00
Mazdak Farrokhzad
46a0e54361
Put 'if let' back into comment.
2019-06-24 07:20:52 +02:00
Mazdak Farrokhzad
b918594369
Fix fallout from rust-lang/rust PR 60861.
2019-06-23 17:24:45 +02:00
Manish Goregaokar
7eb8018554
Rename in_macro to in_macro_or_desugar
2019-05-11 21:39:02 -07:00
Matthew Kraai
753c39672e
Use lint pass macros
...
Fixes #3917 .
2019-04-17 09:35:22 -07:00