Commit Graph

49 Commits

Author SHA1 Message Date
Philipp Krones 62a82b361c Format let-chains across the code base
In the updated nightly version, it seems that rustfmt now supports formatting
let-chains. Since we're using them a lot, it's a lot of reformatting.
2023-11-02 17:24:30 +01:00
Alex Macleod 7347c1803f Set existing doc-tests to no_run 2023-10-23 15:28:26 +00:00
Philipp Krones 81fe8dc084 Merge remote-tracking branch 'upstream/master' into rustup 2023-09-25 10:26:11 +02:00
Philipp Krones 471469d30f Merge commit '98363cbf6a7c3f8b571a7d92a3c645bb4376e4a6' into clippyup 2023-09-12 18:44:06 +02:00
Philipp Krones d2b08432db Merge remote-tracking branch 'upstream/master' into rustup 2023-09-07 21:43:06 +02:00
John Kåre Alsaker 0f74faf158 Use Freeze for SourceFile.lines 2023-09-07 13:05:05 +02:00
Camille GILLOT c3170771f3 Use relative positions inside a SourceFile. 2023-09-03 12:56:10 +00:00
cui fliter b0eaa84cfb fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-09-02 07:30:01 +08:00
Philipp Krones d6d530fd0b Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyup 2023-07-17 10:22:32 +02:00
Alex Macleod 2811effe34 Add imports_granularity = "Module" to rustfmt.toml 2023-07-13 12:44:57 +00:00
Philipp Krones e6dc0efc00 Merge commit '30448e8cf98d4754350db0c959644564f317bc0f' into clippyup 2023-06-02 11:41:57 +02:00
Yuri Astrakhan 68df61ebd9 remove todo 2023-05-22 20:06:58 -04:00
Yuri Astrakhan e926148188 Fix unsafe blocks 2023-05-22 04:07:17 -04:00
Philipp Krones b76b0aeb63 Merge commit '435a8ad86c7a33bd7ffb91c59039943408d3b6aa' into clippyup 2023-05-20 15:39:26 +02:00
Jason Newcomb 0b3c2ed811 Search for inactive cfg attributes and empty macro expansion through
the entire block
2023-05-18 15:43:23 -04:00
Philipp Krones 8df896c076 Merge commit 'd5e2a7aca55ed49fc943b7a07a8eba05ab5a0079' into clippyup 2023-03-24 14:26:19 +01:00
Jason Newcomb 1a81a3e5cf Remove snippet_with_macro_callsite 2023-03-02 00:51:04 -05:00
Philipp Krones d05e2865a0 Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyup 2022-12-01 18:29:38 +01:00
Jason Newcomb e0eba9cafc Don't cross contexts while building the suggestion for redundant_closure_call 2022-11-30 10:53:27 -05:00
Philipp Krones 46c5a5d234 Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup 2022-11-21 20:51:52 +01:00
Samuel Moelius ef5f60285f Move line_span to source.rs 2022-11-19 05:53:49 -05:00
Philipp Krones d75b25faab Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup 2022-10-06 09:44:38 +02:00
Yuri Astrakhan 5a71bbdf3f new uninlined_format_args lint to inline explicit arguments
Implement https://github.com/rust-lang/rust-clippy/issues/8368 - a new
lint to inline format arguments such as `print!("{}", var)` into
`print!("{var}")`.

code | suggestion | comment
---|---|---
`print!("{}", var)` | `print!("{var}")` |  simple variables
`print!("{0}", var)` | `print!("{var}")` |  positional variables
`print!("{v}", v=var)` | `print!("{var}")` |  named variables
`print!("{0} {0}", var)` | `print!("{var} {var}")` |  aliased variables
`print!("{0:1$}", var, width)` | `print!("{var:width$}")` |  width
support
`print!("{0:.1$}", var, prec)` | `print!("{var:.prec$}")` |  precision
support
`print!("{:.*}", prec, var)` | `print!("{var:.prec$}")` |  asterisk
support

code | suggestion | comment
---|---|---
`print!("{0}={1}", var, 1+2)` | `print!("{var}={0}", 1+2)` | Format
string uses an indexed argument that cannot be inlined.  Supporting this
case requires re-indexing of the format string.

changelog: [`uninlined_format_args`]: A new lint to inline format
arguments, i.e. `print!("{}", var)` into `print!("{var}")`
2022-09-25 19:53:03 -04:00
Yuri Astrakhan 59d0e8caba and a few more from other dirs 2022-09-23 14:25:03 -04:00
Philipp Krones dc29cfb8d5 Merge commit '2b2190cb5667cdd276a24ef8b9f3692209c54a89' into clippyup 2022-08-11 19:42:16 +02:00
Jason Newcomb 2ae8b300a7 Don't lint unit_arg when expanded from a proc-macro 2022-08-07 21:52:25 -04:00
Philipp Krones 7d4daaa8fa Merge commit 'fdb84cbfd25908df5683f8f62388f663d9260e39' into clippyup 2022-07-18 09:39:37 +02:00
Josh Triplett b7230d4f44 Dogfood fixes to use bool::then_some 2022-07-06 02:03:56 -07:00
Philipp Krones f067783461 Merge commit 'd9ddce8a223cb9916389c039777b6966ea448dc8' into clippyup 2022-06-04 13:34:07 +02:00
Jason Newcomb eb2908b4ea Add lint almost_complete_letter_range 2022-05-30 23:20:04 -04:00
xFrednet 4587b6628d Merge 'rust-clippy/master' into clippyup 2022-05-21 13:24:00 +02:00
xFrednet 03960ebab2 Replace #[allow] with #[expect] in Clippy 2022-05-07 17:39:21 +02:00
flip1995 7cd86aa1be Merge commit '7c21f91b15b7604f818565646b686d90f99d1baf' into clippyup 2022-05-05 15:12:52 +01:00
whodi 29ef80c78a adding spell checking 2022-04-15 14:18:09 -07:00
Jason Newcomb 63f6a79bf8 Don't lint various match lints when expanded by a proc-macro 2022-04-08 16:51:40 -04:00
flip1995 fb0142ae41 Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyup 2022-01-13 13:18:19 +01:00
Cameron Steffen 02ec39b2ff Stop using in_band_lifetimes 2022-01-11 09:52:23 -06:00
flip1995 8fea1d94f3 Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup 2021-12-06 12:33:31 +01:00
5225225 96db1d6bea fix dogfood lint on clippy_utils 2021-11-09 17:30:15 +00:00
xFrednet d134dddf70 Improve clippy_utils function docs 2021-11-04 12:42:29 +01:00
flip1995 1ad5464200 Merge commit '7bfc26ec8e7a454786668e7e52ffe527fc649735' into clippyup 2021-08-12 11:16:25 +02:00
Jade 11ef04728c Add unwrap_or_else_default lint
This will catch `unwrap_or_else(Default::default)` on Result and Option
and suggest `unwrap_or_default()` instead.
2021-08-10 14:40:26 -07:00
flip1995 d605882023 Merge commit 'b71f3405606d49b9735606b479c3415a0ca9810f' into clippyup 2021-05-06 12:20:44 +02:00
Jason Newcomb ef9ad80617 Add examples to better explain walk_span_to_context 2021-04-22 09:36:46 -04:00
Jason Newcomb 22f8c13cf5 Improve implicit_return
Better suggestions when returning macro calls.
Suggest changeing all the break expressions in a loop, not just the final statement.
Don't lint divergent functions.
Don't suggest returning the result of any divergent fuction.
2021-04-22 09:13:06 -04:00
flip1995 02bf692169 Merge commit '98e2b9f25b6db4b2680a3d388456d9f95cb28344' into clippyup 2021-04-22 11:31:13 +02:00
Jason Newcomb ce5e927713 Improve map_entry lint
Fix false positives where the map is used before inserting into the map.
Fix false positives where two insertions happen.
Suggest using `if let Entry::Vacant(e) = _.entry(_)` when `or_insert` might be a semantic change
2021-04-15 08:19:40 -04:00
flip1995 9f6b5de7de Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup 2021-03-25 19:29:11 +01:00
Cameron Steffen 6fc52a63d1 Move some utils to clippy_utils::source module 2021-03-15 15:34:15 -05:00