When a module contains an unexpected closing bracket, it fails with the aforementioned, unrelated error. STR: - `cargo new foo && cd foo`. - At the beginning of `src/main.rs`, add `mod foo;`. - Create `src/foo.rs` file with the following content: ``` fn foo() {}} ``` - Run `cargo fmt` The output from cargo fmt is `Error writing files: io error: Failed to find module foo in "/tmp/foo/src" None`. The unexpected closing delimiter doesn't need to be at the end of the file (i.e. adding `fn bar() {}` doesn't make it fail with a better error). Doing the same in `main.rs` without the separate file does show an appropriate error.