1 #![warn(clippy::while_let_loop)]
13 #[allow(clippy::never_loop)]
15 // no error, break is not in else clause
52 // no error, else branch does something other than break
62 while let Some(x) = y {
63 // no error, obviously
67 // #675, this used to have a wrong suggestion
69 let (e, l) = match "".split_whitespace().next() {
70 Some(word) => (word.is_empty(), word.len()),
94 let r: Result<u32, u32> = Ok(42);
108 #[allow(clippy::never_loop)]
110 // should not trigger clippy::while_let_loop lint because break passes an expression
121 fn issue_7913(m: &std::sync::Mutex<Vec<u32>>) {
122 // Don't lint. The lock shouldn't be held while printing.
124 let x = if let Some(x) = m.lock().unwrap().pop() {
134 fn issue_5715(mut m: core::cell::RefCell<Option<u32>>) {
135 // Don't lint. The temporary from `borrow_mut` must be dropped before overwriting the `RefCell`.
137 let x = if let &mut Some(x) = &mut *m.borrow_mut() {
143 m = core::cell::RefCell::new(Some(x + 1));