]> git.lizzy.rs Git - rust.git/commitdiff
Always skip children when using Plain write mode
authorMicah Chalmer <micah@micahchalmer.net>
Thu, 28 Apr 2016 05:38:04 +0000 (01:38 -0400)
committerMicah Chalmer <micah@micahchalmer.net>
Thu, 28 Apr 2016 05:44:45 +0000 (01:44 -0400)
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.

src/lib.rs

index 0a222428fe1c5fab24fb1852299328bb78d0b717..942fdb06994c7f54447ad4c4b0b78aba82538ef8 100644 (file)
@@ -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();