Closed
Description
pub struct LipogramCorpora {
selections: Vec<(char, Option<String>)>,
}
impl LipogramCorpora {
pub fn validate_all(&mut self) -> Result<(), char> {
for selection in &self.selections {
if selection.1.is_some() {
if selection.1.unwrap().contains(selection.0) {
return Err(selection.0);
}
}
}
Ok(())
}
}
rustc
should suggest using selection.1..as_ref()
:
error[E0507]: cannot move out of borrowed content
--> src/lib.rs:9:20
|
9 | if selection.1.unwrap().contains(selection.0) {
| ^^^^^^^^^^^
| |
| cannot move out of borrowed content
| help: consider borrowing instead of moving: `selection.1.as_ref()`