#![deny(clippy::drain_collect)] #![allow(dead_code)] use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque}; fn binaryheap(b: &mut BinaryHeap) -> BinaryHeap { b.drain().collect() } fn binaryheap_dont_lint(b: &mut BinaryHeap) -> HashSet { b.drain().collect() } fn hashmap(b: &mut HashMap) -> HashMap { b.drain().collect() } fn hashmap_dont_lint(b: &mut HashMap) -> Vec<(i32, i32)> { b.drain().collect() } fn hashset(b: &mut HashSet) -> HashSet { b.drain().collect() } fn hashset_dont_lint(b: &mut HashSet) -> Vec { b.drain().collect() } fn vecdeque(b: &mut VecDeque) -> VecDeque { b.drain(..).collect() } fn vecdeque_dont_lint(b: &mut VecDeque) -> HashSet { b.drain(..).collect() } fn vec(b: &mut Vec) -> Vec { b.drain(..).collect() } fn vec2(b: &mut Vec) -> Vec { b.drain(0..).collect() } fn vec3(b: &mut Vec) -> Vec { b.drain(..b.len()).collect() } fn vec4(b: &mut Vec) -> Vec { b.drain(0..b.len()).collect() } fn vec_no_reborrow() -> Vec { let mut b = vec![1, 2, 3]; b.drain(..).collect() } fn vec_dont_lint(b: &mut Vec) -> HashSet { b.drain(..).collect() } fn string(b: &mut String) -> String { b.drain(..).collect() } fn string_dont_lint(b: &mut String) -> HashSet { b.drain(..).collect() } fn not_whole_length(v: &mut Vec) -> Vec { v.drain(1..).collect() } fn main() {}