Skip to content

Add extension impls for commonly used core functions and import by default #1968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brson opened this issue Mar 12, 2012 · 1 comment
Closed
Milestone

Comments

@brson
Copy link
Contributor

brson commented Mar 12, 2012

We already have vec.len(). There are a lot of other things that would be nice, particularly everything in option

@brson
Copy link
Contributor Author

brson commented Mar 30, 2012

Done.

@brson brson closed this as completed Mar 30, 2012
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Apr 22, 2025
This lint detects inefficient or useless `{std,core}::mem::swap()` calls
such as:

```rust
    // Should be `a = temp();`
    swap(&mut a, &mut temp());
    // Should be `*b = temp();`
    swap(b, &mut temp());
    // Should be `temp1(); temp2();` if we want to keep the side effects
    swap(&mut temp1(), &mut temp2());
```

It also takes care of using a form appropriate for a `()` context if
`swap()` is part of a larger expression (don't ask me why this wouldn't
happen, I have no idea), by suggesting `{ x = y; }` (statement in block)
or `{std,core}::mem::drop((temp1(), temp2())`.

changelog: [`swap_with_temporary`]: new lint

Close rust-lang#1968
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant