Skip to content

Commit 47cf90a

Browse files
committed
Rebase successful?
1 parent e94e936 commit 47cf90a

File tree

540 files changed

+462
-31841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

540 files changed

+462
-31841
lines changed

CHANGELOG.md

Lines changed: 1 addition & 220 deletions
Large diffs are not rendered by default.

Cargo.toml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
[package]
22
name = "clippy"
3-
<<<<<<< HEAD
4-
<<<<<<< HEAD
53
version = "0.1.73"
6-
=======
7-
version = "0.1.71"
8-
>>>>>>> e4f5d83fa (Fixed formatting.)
9-
=======
10-
version = "0.1.73"
11-
>>>>>>> 0d78a528d (Entered supposed changes, ran cargo dev fmt, test, and bless.)
124
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
135
repository = "https://github.com/rust-lang/rust-clippy"
146
readme = "README.md"
@@ -35,33 +27,13 @@ tempfile = { version = "3.2", optional = true }
3527
termize = "0.1"
3628

3729
[dev-dependencies]
38-
<<<<<<< HEAD
39-
<<<<<<< HEAD
40-
ui_test = "0.11.5"
41-
=======
42-
compiletest_rs = { version = "0.10", features = ["tmp"] }
43-
>>>>>>> e4f5d83fa (Fixed formatting.)
44-
=======
4530
ui_test = "0.11.5"
46-
>>>>>>> 0d78a528d (Entered supposed changes, ran cargo dev fmt, test, and bless.)
4731
tester = "0.9"
4832
regex = "1.5"
4933
toml = "0.7.3"
5034
walkdir = "2.3"
5135
# This is used by the `collect-metadata` alias.
5236
filetime = "0.2"
53-
<<<<<<< HEAD
54-
<<<<<<< HEAD
55-
=======
56-
57-
# UI test dependencies
58-
clap = { version = "4.1.4", features = ["derive"] }
59-
clippy_utils = { path = "clippy_utils" }
60-
derive-new = "0.5"
61-
if_chain = "1.0"
62-
>>>>>>> 066037b62 (actually, remove rustc-workspace-hack dependency too)
63-
=======
64-
>>>>>>> 514b6d04b (Port clippy away from compiletest to ui_test)
6537
itertools = "0.10.1"
6638

6739
# UI test dependencies

book/src/SUMMARY.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,9 @@
1313
- [Development](development/README.md)
1414
- [Basics](development/basics.md)
1515
- [Adding Lints](development/adding_lints.md)
16-
<<<<<<< HEAD
17-
<<<<<<< HEAD
18-
<<<<<<< HEAD
19-
<<<<<<< HEAD
20-
<<<<<<< HEAD
21-
=======
22-
>>>>>>> 4da6e7e06 (rebase attempt)
2316
- [Lint Passes](development/lint_passes.md)
2417
- [Type Checking](development/type_checking.md)
2518
- [Macro Expansions](development/macro_expansions.md)
26-
=======
27-
- [Type Checking](development/type_checking.md)
28-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
29-
=======
30-
- [Lint Passes](development/lint_passes.md)
31-
- [Type Checking](development/type_checking.md)
32-
- [Macro Expansions](development/macro_expansions.md)
33-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
34-
<<<<<<< HEAD
35-
=======
36-
- [Type Checking](development/type_checking.md)
37-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
38-
=======
39-
- [Lint Passes](development/lint_passes.md)
40-
- [Type Checking](development/type_checking.md)
41-
- [Macro Expansions](development/macro_expansions.md)
42-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
43-
=======
44-
>>>>>>> 4da6e7e06 (rebase attempt)
4519
- [Common Tools](development/common_tools_writing_lints.md)
4620
- [Infrastructure](development/infrastructure/README.md)
4721
- [Syncing changes between Clippy and rust-lang/rust](development/infrastructure/sync.md)

book/src/configuration.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
> **Note:** The configuration file is unstable and may be deprecated in the future.
44
5-
<<<<<<< HEAD
6-
<<<<<<< HEAD
7-
=======
8-
>>>>>>> 194343fce (Explain path-search using a list)
95
Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`, which is searched for in:
106

117
1. The directory specified by the `CLIPPY_CONF_DIR` environment variable, or
@@ -14,15 +10,6 @@ Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml
1410
3. The current directory.
1511

1612
It contains a basic `variable = value` mapping e.g.
17-
<<<<<<< HEAD
18-
=======
19-
Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`, placed in a directory specified by
20-
the environment variable `CLIPPY_CONF_DIR`, or if that's not found, the environment variable
21-
[CARGO_MANIFEST_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html), or if that isn't
22-
found, the current directory. It contains a basic `variable = value` mapping e.g.
23-
>>>>>>> 5f5e2e2ac (Explain which paths clippy searches for configuration in docs)
24-
=======
25-
>>>>>>> 194343fce (Explain path-search using a list)
2613

2714
```toml
2815
avoid-breaking-exported-api = false

book/src/development/adding_lints.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,6 @@ Before submitting your PR make sure you followed all the basic requirements:
627627

628628
## Adding configuration to a lint
629629

630-
<<<<<<< HEAD
631-
<<<<<<< HEAD
632-
=======
633-
>>>>>>> 194343fce (Explain path-search using a list)
634630
Clippy supports the configuration of lints values using a `clippy.toml` file which is searched for in:
635631

636632
1. The directory specified by the `CLIPPY_CONF_DIR` environment variable, or
@@ -639,15 +635,6 @@ Clippy supports the configuration of lints values using a `clippy.toml` file whi
639635
3. The current directory.
640636

641637
Adding a configuration to a lint can be useful for
642-
<<<<<<< HEAD
643-
=======
644-
Clippy supports the configuration of lints values using a `clippy.toml` file in a directory specified by
645-
the environment variable `CLIPPY_CONF_DIR`, or if that's not found, the environment variable
646-
[CARGO_MANIFEST_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html), or if that isn't
647-
found, the current directory. Adding a configuration to a lint can be useful for
648-
>>>>>>> 5f5e2e2ac (Explain which paths clippy searches for configuration in docs)
649-
=======
650-
>>>>>>> 194343fce (Explain path-search using a list)
651638
thresholds or to constrain some behavior that can be seen as a false positive
652639
for some users. Adding a configuration is done in the following steps:
653640

book/src/development/lint_passes.md

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,34 +50,7 @@ questions already, but the parser is okay with it. This is what we
5050
mean when we say `EarlyLintPass` deals with only syntax on the AST level.
5151

5252
Alternatively, think of the `foo_functions` lint we mentioned in
53-
<<<<<<< HEAD
54-
<<<<<<< HEAD
55-
<<<<<<< HEAD
56-
<<<<<<< HEAD
57-
<<<<<<< HEAD
58-
define new lints chapter.
59-
=======
6053
define new lints <!-- FIXME: add link --> chapter.
61-
>>>>>>> d1f55e6b5 (run linkcheck in Remark CI)
62-
=======
63-
[define new lints](define_lints.md#name-the-lint) chapter.
64-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
65-
=======
66-
define new lints chapter.
67-
>>>>>>> 6c859b6d2 (Clippy book: hotfix for broken link)
68-
=======
69-
define new lints <!-- FIXME: add link --> chapter.
70-
>>>>>>> d1f55e6b5 (run linkcheck in Remark CI)
71-
=======
72-
define new lints <!-- FIXME: add link --> chapter.
73-
=======
74-
<<<<<<< HEAD
75-
define new lints chapter.
76-
=======
77-
define new lints <!-- FIXME: add link --> chapter.
78-
>>>>>>> d1f55e6b5 (run linkcheck in Remark CI)
79-
>>>>>>> e4f5d83fa (Fixed formatting.)
80-
>>>>>>> 4da6e7e06 (rebase attempt)
8154

8255
We want the `foo_functions` lint to detect functions with `foo` as their name.
8356
Writing a lint that only checks for the name of a function means that we only

book/src/development/type_checking.md

Lines changed: 1 addition & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -51,29 +51,7 @@ impl LateLintPass<'_> for MyStructLint {
5151
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
5252
// Get type of `expr`
5353
let ty = cx.typeck_results().expr_ty(expr);
54-
<<<<<<< HEAD
55-
<<<<<<< HEAD
56-
<<<<<<< HEAD
57-
<<<<<<< HEAD
58-
<<<<<<< HEAD
59-
=======
60-
>>>>>>> 4da6e7e06 (rebase attempt)
61-
62-
=======
63-
64-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
65-
=======
66-
67-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
68-
<<<<<<< HEAD
69-
=======
70-
71-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
72-
=======
73-
74-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
75-
=======
76-
>>>>>>> 4da6e7e06 (rebase attempt)
54+
7755
// Check if the `Ty` of this expression is of character type
7856
if ty.is_char() {
7957
println!("Our expression is a char!");
@@ -92,79 +70,18 @@ pub fn is_char(self) -> bool {
9270
}
9371
```
9472

95-
<<<<<<< HEAD
96-
<<<<<<< HEAD
97-
<<<<<<< HEAD
98-
<<<<<<< HEAD
99-
<<<<<<< HEAD
100-
=======
101-
>>>>>>> 4da6e7e06 (rebase attempt)
102-
Indeed, we just discovered `Ty`'s [`kind()` method][kind], which provides us
103-
=======
104-
Indeed, we just discovered `Ty`'s [`kind` method][kind], which provides us
105-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
106-
=======
107-
Indeed, we just discovered `Ty`'s [`kind()` method][kind], which provides us
108-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
109-
<<<<<<< HEAD
110-
=======
111-
Indeed, we just discovered `Ty`'s [`kind` method][kind], which provides us
112-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
113-
=======
11473
Indeed, we just discovered `Ty`'s [`kind()` method][kind], which provides us
115-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
116-
=======
117-
>>>>>>> 4da6e7e06 (rebase attempt)
11874
with [`TyKind`][TyKind] of a `Ty`.
11975

12076
## `TyKind`
12177

12278
`TyKind` defines the kinds of types in Rust's type system.
12379
Peeking into [`TyKind` documentation][TyKind], we will see that it is an
124-
<<<<<<< HEAD
125-
<<<<<<< HEAD
126-
<<<<<<< HEAD
127-
<<<<<<< HEAD
128-
<<<<<<< HEAD
129-
=======
130-
>>>>>>> 4da6e7e06 (rebase attempt)
131-
enum of over 25 variants, including items such as `Bool`, `Int`, `Ref`, etc.
132-
133-
### `kind` Usage
134-
135-
The `TyKind` of `Ty` can be returned by calling [`Ty.kind()` method][kind].
136-
=======
137-
<<<<<<< HEAD
138-
=======
139-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
140-
=======
141-
>>>>>>> 4da6e7e06 (rebase attempt)
142-
enum of 27 variants, including items such as `Bool`, `Int`, `Ref`, etc.
143-
144-
### `kind` Usage
145-
146-
The `TyKind` of `Ty` can be returned by calling [`Ty.kind` method][kind].
147-
<<<<<<< HEAD
148-
<<<<<<< HEAD
149-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
150-
=======
151-
enum of over 25 variants, including items such as `Bool`, `Int`, `Ref`, etc.
152-
153-
### `kind` Usage
154-
155-
The `TyKind` of `Ty` can be returned by calling [`Ty.kind()` method][kind].
156-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
157-
=======
158-
=======
159-
>>>>>>> 4da6e7e06 (rebase attempt)
160-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
161-
=======
16280
enum of over 25 variants, including items such as `Bool`, `Int`, `Ref`, etc.
16381

16482
### `kind` Usage
16583

16684
The `TyKind` of `Ty` can be returned by calling [`Ty.kind()` method][kind].
167-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
16885
We often use this method to perform pattern matching in Clippy.
16986

17087
For instance, if we want to check for a `struct`, we could examine if the
@@ -190,61 +107,8 @@ impl LateLintPass<'_> for MyStructLint {
190107
We've been talking about [`ty::Ty`][middle_ty] this whole time without addressing [`hir::Ty`][hir_ty], but the latter
191108
is also important to understand.
192109

193-
<<<<<<< HEAD
194-
<<<<<<< HEAD
195-
<<<<<<< HEAD
196-
<<<<<<< HEAD
197-
<<<<<<< HEAD
198-
=======
199-
>>>>>>> 4da6e7e06 (rebase attempt)
200-
`hir::Ty` would represent *what* the user wrote, while `ty::Ty` is how the compiler sees the type and has more
201-
information. Example:
202-
203-
```rust
204-
fn foo(x: u32) -> u32 { x }
205-
```
206-
207-
Here the HIR sees the types without "thinking" about them, it knows that the function takes an `u32` and returns
208-
an `u32`. As far as `hir::Ty` is concerned those might be different types. But at the `ty::Ty` level the compiler
209-
understands that they're the same type, in-depth lifetimes, etc...
210-
211-
To get from a `hir::Ty` to a `ty::Ty`, you can use the [`hir_ty_to_ty`][hir_ty_to_ty] function outside of bodies or
212-
outside of bodies the [`TypeckResults::node_type()`][node_type] method.
213-
214-
> **Warning**: Don't use `hir_ty_to_ty` inside of bodies, because this can cause ICEs.
215-
=======
216-
`hir::Ty` would represent *what* an user wrote, while `ty::Ty` would understand the meaning of it (because it has more
217-
information).
218-
=======
219-
`hir::Ty` would represent *what* the user wrote, while `ty::Ty` is how the compiler sees the type and has more
220-
information. Example:
221-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
222-
223-
```rust
224-
fn foo(x: u32) -> u32 { x }
225-
```
226-
227-
Here the HIR sees the types without "thinking" about them, it knows that the function takes an `u32` and returns
228-
an `u32`. As far as `hir::Ty` is concerned those might be different types. But at the `ty::Ty` level the compiler
229-
understands that they're the same type, in-depth lifetimes, etc...
230-
231-
<<<<<<< HEAD
232-
you can use the [`hir_ty_to_ty`][hir_ty_to_ty] function to convert from a `hir::Ty` to a `ty::Ty`
233-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
234-
=======
235-
To get from a `hir::Ty` to a `ty::Ty`, you can use the [`hir_ty_to_ty`][hir_ty_to_ty] function outside of bodies or
236-
outside of bodies the [`TypeckResults::node_type()`][node_type] method.
237-
238-
> **Warning**: Don't use `hir_ty_to_ty` inside of bodies, because this can cause ICEs.
239-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
240-
<<<<<<< HEAD
241-
=======
242-
`hir::Ty` would represent *what* an user wrote, while `ty::Ty` would understand the meaning of it (because it has more
243-
information).
244-
=======
245110
`hir::Ty` would represent *what* the user wrote, while `ty::Ty` is how the compiler sees the type and has more
246111
information. Example:
247-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
248112

249113
```rust
250114
fn foo(x: u32) -> u32 { x }
@@ -254,17 +118,10 @@ Here the HIR sees the types without "thinking" about them, it knows that the fun
254118
an `u32`. As far as `hir::Ty` is concerned those might be different types. But at the `ty::Ty` level the compiler
255119
understands that they're the same type, in-depth lifetimes, etc...
256120

257-
<<<<<<< HEAD
258-
you can use the [`hir_ty_to_ty`][hir_ty_to_ty] function to convert from a `hir::Ty` to a `ty::Ty`
259-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
260-
=======
261121
To get from a `hir::Ty` to a `ty::Ty`, you can use the [`hir_ty_to_ty`][hir_ty_to_ty] function outside of bodies or
262122
outside of bodies the [`TypeckResults::node_type()`][node_type] method.
263123

264124
> **Warning**: Don't use `hir_ty_to_ty` inside of bodies, because this can cause ICEs.
265-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
266-
=======
267-
>>>>>>> 4da6e7e06 (rebase attempt)
268125
269126
## Useful Links
270127

@@ -279,27 +136,7 @@ in this chapter:
279136
[Adt]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/sty/enum.TyKind.html#variant.Adt
280137
[AdtDef]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/adt/struct.AdtDef.html
281138
[expr_ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeckResults.html#method.expr_ty
282-
<<<<<<< HEAD
283-
<<<<<<< HEAD
284-
<<<<<<< HEAD
285-
<<<<<<< HEAD
286-
<<<<<<< HEAD
287-
=======
288-
>>>>>>> 4da6e7e06 (rebase attempt)
289-
[node_type]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeckResults.html#method.node_type
290-
=======
291-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
292-
=======
293-
[node_type]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeckResults.html#method.node_type
294-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
295-
<<<<<<< HEAD
296-
=======
297-
>>>>>>> 6b95029f1 (Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup)
298-
=======
299139
[node_type]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeckResults.html#method.node_type
300-
>>>>>>> a1b75c510 (Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup)
301-
=======
302-
>>>>>>> 4da6e7e06 (rebase attempt)
303140
[is_char]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Ty.html#method.is_char
304141
[is_char_source]: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/ty/sty.rs.html#1831-1834
305142
[kind]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Ty.html#method.kind

0 commit comments

Comments
 (0)