#![warn(clippy::zero_sized_map_values)] use std::collections::BTreeMap; const CONST_OK: Option> = None; const CONST_NOT_OK: Option> = None; //~^ ERROR: map with zero-sized value type static STATIC_OK: Option> = None; static STATIC_NOT_OK: Option> = None; //~^ ERROR: map with zero-sized value type type OkMap = BTreeMap; type NotOkMap = BTreeMap; //~^ ERROR: map with zero-sized value type enum TestEnum { Ok(BTreeMap), NotOk(BTreeMap), //~^ ERROR: map with zero-sized value type } struct Test { ok: BTreeMap, not_ok: BTreeMap, //~^ ERROR: map with zero-sized value type also_not_ok: Vec>, //~^ ERROR: map with zero-sized value type } trait TestTrait { type Output; fn produce_output() -> Self::Output; fn weird_map(&self, map: BTreeMap); //~^ ERROR: map with zero-sized value type } impl Test { fn ok(&self) -> BTreeMap { todo!() } fn not_ok(&self) -> BTreeMap { //~^ ERROR: map with zero-sized value type todo!() } } impl TestTrait for Test { type Output = BTreeMap; fn produce_output() -> Self::Output { todo!(); } fn weird_map(&self, map: BTreeMap) { todo!(); } } fn test(map: BTreeMap, key: &str) -> BTreeMap { //~^ ERROR: map with zero-sized value type //~| ERROR: map with zero-sized value type todo!(); } fn test2(map: BTreeMap, key: &str) -> BTreeMap { todo!(); } fn main() { let _: BTreeMap = BTreeMap::new(); //~^ ERROR: map with zero-sized value type //~| ERROR: map with zero-sized value type let _: BTreeMap = BTreeMap::new(); let _: BTreeMap<_, _> = std::iter::empty::<(String, ())>().collect(); //~^ ERROR: map with zero-sized value type }