File tree 1 file changed +9
-3
lines changed
rustfmt-core/rustfmt-lib/src/formatting
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -869,9 +869,15 @@ fn has_url(s: &str) -> bool {
869
869
}
870
870
871
871
/// Returns true if the given string may be part of a Markdown talble.
872
- fn is_table_item ( s : & str ) -> bool {
873
- // This function may return false positive, but should get its job done in most cases.
874
- s. trim_start ( ) . starts_with ( '|' )
872
+ fn is_table_item ( mut s : & str ) -> bool {
873
+ // This function may return false positive, but should get its job done in most cases (i.e.
874
+ // markdown tables with two column delimiters).
875
+ s = s. trim_start ( ) ;
876
+ return s. starts_with ( '|' )
877
+ && match s. rfind ( '|' ) {
878
+ Some ( 0 ) | None => false ,
879
+ _ => true ,
880
+ } ;
875
881
}
876
882
877
883
/// Given the span, rewrite the missing comment inside it if available.
You can’t perform that action at this time.
0 commit comments