1 #![warn(clippy::while_let_loop)]
2 #![allow(clippy::uninlined_format_args)]
14 #[allow(clippy::never_loop)]
16 // no error, break is not in else clause
53 // no error, else branch does something other than break
63 while let Some(x) = y {
64 // no error, obviously
68 // #675, this used to have a wrong suggestion
70 let (e, l) = match "".split_whitespace().next() {
71 Some(word) => (word.is_empty(), word.len()),
95 let r: Result<u32, u32> = Ok(42);
109 #[allow(clippy::never_loop)]
111 // should not trigger clippy::while_let_loop lint because break passes an expression
122 fn issue_7913(m: &std::sync::Mutex<Vec<u32>>) {
123 // Don't lint. The lock shouldn't be held while printing.
125 let x = if let Some(x) = m.lock().unwrap().pop() {
135 fn issue_5715(mut m: core::cell::RefCell<Option<u32>>) {
136 // Don't lint. The temporary from `borrow_mut` must be dropped before overwriting the `RefCell`.
138 let x = if let &mut Some(x) = &mut *m.borrow_mut() {
144 m = core::cell::RefCell::new(Some(x + 1));