Skip to content
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

When moving out of a for loop head, suggest borrowing it #59195

Merged
merged 2 commits into from
Mar 25, 2019

Commits on Mar 24, 2019

  1. When moving out of a for loop head, suggest borrowing it

    When encountering code like the following, suggest borrowing the for loop
    head to avoid moving it into the for loop pattern:
    
    ```
    fn main() {
        let a = vec![1, 2, 3];
        for i in &a {
            for j in a {
                println!("{} * {} = {}", i, j, i * j);
            }
        }
    }
    ```
    estebank committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    ae883dc View commit details
    Browse the repository at this point in the history
  2. Add nll test

    estebank committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    66202c1 View commit details
    Browse the repository at this point in the history