First, I'm going to assume you're using edition 2018. You can look for
edition = "2018" in
Cargo.toml to be sure. The module pathing was updated across editions and you may need to change some things or try
rustfix if you're updating code from one edition to the another. Most but probably not all of what follows applies to both currently existing editions.
Next, I see a
src/mod.rs. As far as I know, nothing looks for that file automatically. You almost certainly meant
src/lib.rs. The first thing I would try is renaming that file.
After that, note that aside from
src/main.rs, cargo and rust don't look for files that just happen to be in
src. Instead you have to declare modules in the files it's already looking in. So it's possible that you're missing some statements like
mod nnet_auto_optimization; in (what will presumably soon be renamed to)
lib.rs. Once you have a
lib.rs, if you're still getting those errors, this is the next thing I would check.
Furthermore, you don't need
src/submodule/mod.rs anymore, you can use
src/submodule.rs instead. But you can still use
src/submodule/mod.rs if you prefer, so this shouldn't be a source of any of your problems.
Taken altogether, I would expect something like
lib.rs -- declares
mod nnet_auto_optimization and
nnet_auto_optimization.rs -- declares
mod optimize_nnet and
testing_config.rs -- declares