I ran into this same issue and found a related GitHub issue on the esp-hal repo which led me to this documentation update.
Your solution was very close, the only thing missing was a call to enable_input()
:
let mut od_for_dht22_in = Output::new(peripherals.GPIO4, esp_hal::gpio::Level::High, od_config)
.into_flex();
od_for_dht22_in.enable_input(true);