mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-14 17:48:10 +00:00
4838c78ba4
Locals which can be partially moved created within the to-be-created closure shouldn't block the use of a closure
19 lines
326 B
Rust
19 lines
326 B
Rust
// run-rustfix
|
|
|
|
#![warn(clippy::map_entry)]
|
|
#![allow(dead_code)]
|
|
|
|
use std::collections::BTreeMap;
|
|
|
|
fn foo() {}
|
|
|
|
fn btree_map<K: Eq + Ord + Copy, V: Copy>(m: &mut BTreeMap<K, V>, k: K, v: V) {
|
|
// insert then do something, use if let
|
|
if !m.contains_key(&k) {
|
|
m.insert(k, v);
|
|
foo();
|
|
}
|
|
}
|
|
|
|
fn main() {}
|