You need to import the trait that implements the flush method for Stdout.
According to the documentation:

Therefore:
use std::io::Write; // <--- bring the trait into scope
fn main() {
std::io::stdout().flush().expect("some error message");
}
Playground example