diff --git a/src/formatting.rs b/src/formatting.rs index acfd3723b1a..4787b15e94a 100644 --- a/src/formatting.rs +++ b/src/formatting.rs @@ -101,7 +101,7 @@ fn format_project( let files = modules::ModResolver::new( context.parse_session.source_map(), directory_ownership.unwrap_or(parse::DirectoryOwnership::UnownedViaMod(false)), - input_is_stdin, + !(input_is_stdin || config.skip_children()), ) .visit_crate(&krate) .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; diff --git a/src/modules.rs b/src/modules.rs index 4140cb4f545..9da76de19ff 100644 --- a/src/modules.rs +++ b/src/modules.rs @@ -18,7 +18,7 @@ pub(crate) struct ModResolver<'a, 'b> { source_map: &'b source_map::SourceMap, directory: Directory, file_map: FileModMap<'a>, - is_input_stdin: bool, + recursive: bool, } #[derive(Clone)] @@ -32,7 +32,7 @@ impl<'a, 'b> ModResolver<'a, 'b> { pub(crate) fn new( source_map: &'b source_map::SourceMap, directory_ownership: DirectoryOwnership, - is_input_stdin: bool, + recursive: bool, ) -> Self { ModResolver { directory: Directory { @@ -41,7 +41,7 @@ pub(crate) fn new( }, file_map: BTreeMap::new(), source_map, - is_input_stdin, + recursive, } } @@ -57,7 +57,7 @@ pub(crate) fn visit_crate(mut self, krate: &'a ast::Crate) -> Result