Skip to content

Commit

Permalink
Bless/fix unrelated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Sep 11, 2024
1 parent b89d93b commit 6b8697b
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6155,6 +6155,7 @@ Released 2018-09-13
[`excessive-nesting-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#excessive-nesting-threshold
[`future-size-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#future-size-threshold
[`ignore-interior-mutability`]: https://doc.rust-lang.org/clippy/lint_configuration.html#ignore-interior-mutability
[`large-cell-limit`]: https://doc.rust-lang.org/clippy/lint_configuration.html#large-cell-limit
[`large-error-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#large-error-threshold
[`literal-representation-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#literal-representation-threshold
[`matches-for-let-else`]: https://doc.rust-lang.org/clippy/lint_configuration.html#matches-for-let-else
Expand Down
10 changes: 10 additions & 0 deletions book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,16 @@ A list of paths to types that should be treated as if they do not contain interi
* [`mutable_key_type`](https://rust-lang.github.io/rust-clippy/master/index.html#mutable_key_type)


## `large-cell-limit`
The maximum size of a `T` in `RefCell<T>` to suggest to swap to `Cell` if applicable.

**Default Value:** `256`

---
**Affected lints:**
* [`copy_refcell`](https://rust-lang.github.io/rust-clippy/master/index.html#copy_refcell)


## `large-error-threshold`
The maximum size of the `Err`-variant in a `Result` returned from a function

Expand Down
3 changes: 3 additions & 0 deletions tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
excessive-nesting-threshold
future-size-threshold
ignore-interior-mutability
large-cell-limit
large-error-threshold
literal-representation-threshold
matches-for-let-else
Expand Down Expand Up @@ -128,6 +129,7 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
excessive-nesting-threshold
future-size-threshold
ignore-interior-mutability
large-cell-limit
large-error-threshold
literal-representation-threshold
matches-for-let-else
Expand Down Expand Up @@ -212,6 +214,7 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni
excessive-nesting-threshold
future-size-threshold
ignore-interior-mutability
large-cell-limit
large-error-threshold
literal-representation-threshold
matches-for-let-else
Expand Down
1 change: 1 addition & 0 deletions tests/ui/await_holding_refcell_ref.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::await_holding_refcell_ref)]
#![allow(clippy::copy_refcell)]

use std::cell::RefCell;

Expand Down
24 changes: 12 additions & 12 deletions tests/ui/await_holding_refcell_ref.stderr
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:6:9
--> tests/ui/await_holding_refcell_ref.rs:7:9
|
LL | let b = x.borrow();
| ^
|
= help: ensure the reference is dropped before calling `await`
note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:8:11
--> tests/ui/await_holding_refcell_ref.rs:9:11
|
LL | baz().await
| ^^^^^
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::await_holding_refcell_ref)]`

error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:12:9
--> tests/ui/await_holding_refcell_ref.rs:13:9
|
LL | let b = x.borrow_mut();
| ^
|
= help: ensure the reference is dropped before calling `await`
note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:14:11
--> tests/ui/await_holding_refcell_ref.rs:15:11
|
LL | baz().await
| ^^^^^

error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:34:9
--> tests/ui/await_holding_refcell_ref.rs:35:9
|
LL | let b = x.borrow_mut();
| ^
|
= help: ensure the reference is dropped before calling `await`
note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:37:24
--> tests/ui/await_holding_refcell_ref.rs:38:24
|
LL | let second = baz().await;
| ^^^^^
Expand All @@ -43,40 +43,40 @@ LL | let third = baz().await;
| ^^^^^

error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:47:9
--> tests/ui/await_holding_refcell_ref.rs:48:9
|
LL | let b = x.borrow_mut();
| ^
|
= help: ensure the reference is dropped before calling `await`
note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:50:24
--> tests/ui/await_holding_refcell_ref.rs:51:24
|
LL | let second = baz().await;
| ^^^^^

error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:63:13
--> tests/ui/await_holding_refcell_ref.rs:64:13
|
LL | let b = x.borrow_mut();
| ^
|
= help: ensure the reference is dropped before calling `await`
note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:65:15
--> tests/ui/await_holding_refcell_ref.rs:66:15
|
LL | baz().await
| ^^^^^

error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:76:13
--> tests/ui/await_holding_refcell_ref.rs:77:13
|
LL | let b = x.borrow_mut();
| ^
|
= help: ensure the reference is dropped before calling `await`
note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:78:15
--> tests/ui/await_holding_refcell_ref.rs:79:15
|
LL | baz().await
| ^^^^^
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/clone_on_copy.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
clippy::unnecessary_operation,
clippy::vec_init_then_push,
clippy::toplevel_ref_arg,
clippy::needless_borrow
clippy::needless_borrow,
clippy::copy_refcell
)]

use std::cell::RefCell;
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/clone_on_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
clippy::unnecessary_operation,
clippy::vec_init_then_push,
clippy::toplevel_ref_arg,
clippy::needless_borrow
clippy::needless_borrow,
clippy::copy_refcell
)]

use std::cell::RefCell;
Expand Down
18 changes: 9 additions & 9 deletions tests/ui/clone_on_copy.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: using `clone` on type `i32` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:23:5
--> tests/ui/clone_on_copy.rs:24:5
|
LL | 42.clone();
| ^^^^^^^^^^ help: try removing the `clone` call: `42`
Expand All @@ -8,49 +8,49 @@ LL | 42.clone();
= help: to override `-D warnings` add `#[allow(clippy::clone_on_copy)]`

error: using `clone` on type `i32` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:27:5
--> tests/ui/clone_on_copy.rs:28:5
|
LL | (&42).clone();
| ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`

error: using `clone` on type `i32` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:30:5
--> tests/ui/clone_on_copy.rs:31:5
|
LL | rc.borrow().clone();
| ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*rc.borrow()`

error: using `clone` on type `u32` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:33:5
--> tests/ui/clone_on_copy.rs:34:5
|
LL | x.clone().rotate_left(1);
| ^^^^^^^^^ help: try removing the `clone` call: `x`

error: using `clone` on type `i32` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:47:5
--> tests/ui/clone_on_copy.rs:48:5
|
LL | m!(42).clone();
| ^^^^^^^^^^^^^^ help: try removing the `clone` call: `m!(42)`

error: using `clone` on type `[u32; 2]` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:57:5
--> tests/ui/clone_on_copy.rs:58:5
|
LL | x.clone()[0];
| ^^^^^^^^^ help: try dereferencing it: `(*x)`

error: using `clone` on type `char` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:67:14
--> tests/ui/clone_on_copy.rs:68:14
|
LL | is_ascii('z'.clone());
| ^^^^^^^^^^^ help: try removing the `clone` call: `'z'`

error: using `clone` on type `i32` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:71:14
--> tests/ui/clone_on_copy.rs:72:14
|
LL | vec.push(42.clone());
| ^^^^^^^^^^ help: try removing the `clone` call: `42`

error: using `clone` on type `Option<i32>` which implements the `Copy` trait
--> tests/ui/clone_on_copy.rs:75:17
--> tests/ui/clone_on_copy.rs:76:17
|
LL | let value = opt.clone()?; // operator precedence needed (*opt)?
| ^^^^^^^^^^^ help: try dereferencing it: `(*opt)`
Expand Down

0 comments on commit 6b8697b

Please sign in to comment.