You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0597]: `version_regex` does not live long enough
--> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/os_info-1.3.3/src/linux/file_release.rs:36:13
|
34 | let version_regex = Regex::new(release_info.version_regex).unwrap();
| ------------- binding `version_regex` declared here
35 |
36 | / version_regex
37 | | .captures_iter(&file_content)
| | ^
| | |
| |_____________________________________________borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
...
41 | } else {
| -
| |
| `version_regex` dropped here while still borrowed
| ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `regex::CaptureMatches<'_, '_>`
|
= note: the temporary is part of an expression at the end of a block;
consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
|
36 ~ let x = version_regex
37 | .captures_iter(&file_content)
38 | .next()
39 | .and_then(|c| c.get(1))
40 ~ .map(|v| v.as_str().trim_end().to_owned()); x
|
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: