Skip to content

Commit

Permalink
Always skip children when using Plain write mode
Browse files Browse the repository at this point in the history
Outputting child module contents in the "Plain" write mode does not make
sense, since there is no way to differentiate code that came from a
child module from that which came from the parent file.
  • Loading branch information
MicahChalmer committed Apr 28, 2016
1 parent de2b8d9 commit 70611bf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib.rs
Expand Up @@ -280,8 +280,11 @@ fn format_ast(krate: &ast::Crate,
config: &Config)
-> FileMap {
let mut file_map = FileMap::new();
// We always skip children for the "Plain" write mode, since there is
// nothing to distinguish the nested module contents.
let skip_children = config.skip_children || config.write_mode == config::WriteMode::Plain;
for (path, module) in modules::list_files(krate, parse_session.codemap()) {
if config.skip_children && path.as_path() != main_file {
if skip_children && path.as_path() != main_file {
continue;
}
let path = path.to_str().unwrap();
Expand Down

0 comments on commit 70611bf

Please sign in to comment.