File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1154,6 +1154,25 @@ pub fn format_struct_struct(
1154
1154
}
1155
1155
}
1156
1156
1157
+ /// Returns a bytepos that is after that of `(` in `pub(..)`. If the given visibility does not
1158
+ /// contain `pub(..)`, then return the `lo` of the `defualt_span`. Yeah, but for what? Well, we need
1159
+ /// to bypass the `(` in the visibility when creating a span of tuple's body or fn's args.
1160
+ fn get_bytepos_after_visibility (
1161
+ context : & RewriteContext ,
1162
+ vis : & ast:: Visibility ,
1163
+ default_span : Span ,
1164
+ terminator : & str ,
1165
+ ) -> BytePos {
1166
+ match * vis {
1167
+ ast:: Visibility :: Crate ( s, CrateSugar :: PubCrate ) => context
1168
+ . codemap
1169
+ . span_after ( mk_sp ( s. hi ( ) , default_span. hi ( ) ) , terminator) ,
1170
+ ast:: Visibility :: Crate ( s, CrateSugar :: JustCrate ) => s. hi ( ) ,
1171
+ ast:: Visibility :: Restricted { ref path, .. } => path. span . hi ( ) ,
1172
+ _ => default_span. lo ( ) ,
1173
+ }
1174
+ }
1175
+
1157
1176
fn format_tuple_struct (
1158
1177
context : & RewriteContext ,
1159
1178
item_name : & str ,
You can’t perform that action at this time.
0 commit comments