]> git.lizzy.rs Git - rust.git/commitdiff
Move rewrite_mod to the items module
authortopecongiro <seuchida@gmail.com>
Sat, 17 Feb 2018 16:11:43 +0000 (01:11 +0900)
committerSeiichi Uchida <seuchida@gmail.com>
Sat, 17 Feb 2018 16:38:31 +0000 (01:38 +0900)
rustfmt-core/src/imports.rs
rustfmt-core/src/items.rs
rustfmt-core/src/reorder.rs

index 513bd20023388c911d33fcac30c72d63e95144b0..f4a7a19ebe45440aac7c9eccbad49542b0612928 100644 (file)
@@ -124,16 +124,6 @@ pub fn rewrite_import(
     }
 }
 
-/// Rewrite an inline mod.
-pub fn rewrite_mod(item: &ast::Item) -> String {
-    let mut result = String::with_capacity(32);
-    result.push_str(&*format_visibility(&item.vis));
-    result.push_str("mod ");
-    result.push_str(&item.ident.to_string());
-    result.push(';');
-    result
-}
-
 impl<'a> FmtVisitor<'a> {
     pub fn format_imports(&mut self, use_items: &[&ast::Item]) {
         if use_items.is_empty() {
index 11568278e1d5921f02ecfe61cecfdf3d4566fd1d..07b6c1d79bff163aa7a9fb4eaba06b50314c45bf 100644 (file)
@@ -2845,3 +2845,13 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
         }
     }
 }
+
+/// Rewrite an inline mod.
+pub fn rewrite_mod(item: &ast::Item) -> String {
+    let mut result = String::with_capacity(32);
+    result.push_str(&*format_visibility(&item.vis));
+    result.push_str("mod ");
+    result.push_str(&item.ident.to_string());
+    result.push(';');
+    result
+}
index df08f0662d48b486a2955c870acbfa77628f5e3f..eff8aec06a9d78f87b9475a8dde7cb28ff3c068f 100644 (file)
@@ -18,7 +18,8 @@
 use syntax::{ast, codemap::Span};
 
 use comment::combine_strs_with_missing_comments;
-use imports::{path_to_imported_ident, rewrite_import, rewrite_mod};
+use imports::{path_to_imported_ident, rewrite_import};
+use items::rewrite_mod;
 use lists::{itemize_list, write_list, ListFormatting};
 use rewrite::{Rewrite, RewriteContext};
 use shape::Shape;