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

Remove pre-NLL borrow checker workarounds #1036

Merged
merged 1 commit into from
Jul 11, 2023
Merged

Commits on Jul 11, 2023

  1. Remove pre-NLL borrow checker workarounds

    NLL has been in use since Rust 1.31 (for edition 2018+) or Rust
    1.36 (for edition 2015).
    
        error[E0505]: cannot move out of `json` because it is borrowed
           --> src/raw.rs:184:29
            |
        180 |             let borrowed = ::from_str::<&Self>(&json)?;
            |                                                 ---- borrow of `json` occurs here
        ...
        184 |         Ok(Self::from_owned(json.into_boxed_str()))
            |                             ^^^^ move out of `json` occurs here
    
        error[E0499]: cannot borrow `self.formatter` as mutable more than once at a time
           --> src/ser.rs:453:13
            |
        444 |                 formatter: &mut self.formatter,
            |                                 -------------- first mutable borrow occurs here
        ...
        453 |             self.formatter
            |             ^^^^^^^^^^^^^^ second mutable borrow occurs here
        ...
        456 |     }
            |     - first borrow ends here
    
        error[E0499]: cannot borrow `self.writer` as mutable more than once at a time
           --> src/ser.rs:454:34
            |
        443 |                 writer: &mut self.writer,
            |                              ----------- first mutable borrow occurs here
        ...
        454 |                 .end_string(&mut self.writer)
            |                                  ^^^^^^^^^^^ second mutable borrow occurs here
        ...
        456 |     }
            |     - first borrow ends here
    dtolnay committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    f899904 View commit details
    Browse the repository at this point in the history