Skip to content

Lint checking for non-implicitly-copyable-typarams - #5101

Closed
tychosci wants to merge 1 commit into
rust-lang:incomingfrom
tychosci:lint-nonimplicitly-copyable
Closed

Lint checking for non-implicitly-copyable-typarams#5101
tychosci wants to merge 1 commit into
rust-lang:incomingfrom
tychosci:lint-nonimplicitly-copyable

Conversation

@tychosci

Copy link
Copy Markdown
Contributor

The lint checking for non-implicitly-copyable-typarams has somehow been removed at a380df8, but I don't think it is intentional.

@nikomatsakis

Copy link
Copy Markdown
Contributor

Actually, that was intentional. It was generally considered that this warning did more harm than good.

Perhaps though it is good to bring it back, and just change the default setting to disabled.

@tychosci

Copy link
Copy Markdown
ContributorAuthor

Ahh, I see. Thanks! If that was intentional, I have nothing to say against it.

bors added a commit to rust-lang-ci/rust that referenced this pull request May 2, 2020
add `let_underscore_lock` lint
closesrust-lang#1574
changelog: add `let_underscore_lock` lint
I am not entirely sure about my docs/messages wording here, improvements are welcome
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 20, 2020
Add `let_underscore_drop`
This line generalizes `let_underscore_lock` (rust-lang#5101) to warn about any initializer expression that implements `Drop`.
So, for example, the following would generate a warning:
```rust
struct Droppable;
impl Drop for Droppable {
fn drop(&mut self) {}
}
let _ = Droppable;
```
I tried to preserve the original `let_underscore_lock` functionality in the sense that the warning generated for
```rust
let _ = mutex.lock();
```
should be unchanged.
*Please keep the line below*
changelog: Add lint [`let_underscore_drop`]
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
5101: Add expect -- a light-weight alternative to insta r=matklad a=matklad
This PR implements a small snapshot-testing library. Snapshot updating is done by setting an env var, or by using editor feature (which runs a test with env-var set). Here's workflow for updating a failing test:
![expect](https://user-images.githubusercontent.com/1711539/85926956-28afa080-b8a3-11ea-9260-c6d0d8914d0b.gif)
Here's workflow for adding a new test:
![expect-fresh](https://user-images.githubusercontent.com/1711539/85926961-306f4500-b8a3-11ea-9369-f2373e327a3f.gif)
Note that colorized diffs are not implemented in this PR, but should be easy to add (we already use them in test_utils). Main differences from insta (which is essential for rust-analyzer development, thanks @mitsuhiko!):
* self-updating tests, no need for a separate tool
* fewer features (only inline snapshots, no redactions)
* fewer deps (no yaml, no persistence)
* tighter integration with editor
* first-class snapshot object, which can be used to write test functions (as opposed to testing macros)
* trivial to tweak for rust-analyzer needs, by virtue of being a workspace member. I think eventually we should converge to a single snapshot testing library, but I am not sure that `expect` is exactly right, so I suggest rolling with both insta and expect for some time (if folks agree that expect might be better in the first place!). # Editor Integration Implementation The thing I am most excited about is the ability to update a specific snapshot from the editor. I want this to be available to other snapshot-testing libraries (cc @mitsuhiko, @aaronabramov), so I want to document how this works. The ideal UI here would be a code action (:bulb:). Unfortunately, it seems like it is impossible to implement without some kind of persistence (if you save test failures into some kind of a database, like insta does, than you can read the database from the editor plugin). Note that it is possible to highlight error by outputing error message in rustc's format. Unfortunately, one can't use the same trick to implement a quick fix. For this reason, expect makes use of another rust-analyzer feature -- ability to run a single test at the cursor position. This does need some expect-specific code in rust-analyzer unfortunately. Specifically, if rust-analyzer notices that the cursor is on `expect!` macro, it adds a special flag to runnable's JSON. However, given rust-lang#5017 it is possible to approximate this well-enough without rust-analyzer integration. Specifically, an extension can register a special runner which checks (using regexes) if rust-anlyzer runnable covers text with specific macro invocation and do special magic in that case. closesrust-lang#3835 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@tychosci@nikomatsakis