@@ -1973,6 +1973,16 @@ pub(crate) fn rewrite_rhs_expr<R: Rewrite>(
1973
1973
)
1974
1974
}
1975
1975
1976
+ fn rewrite_assign_rhs_expr < R : Rewrite > (
1977
+ context : & RewriteContext < ' _ > ,
1978
+ lhs : & str ,
1979
+ ex : & R ,
1980
+ shape : Shape ,
1981
+ rhs_tactics : RhsTactics ,
1982
+ ) -> Option < String > {
1983
+ rewrite_rhs_expr ( context, & lhs, ex, shape, rhs_tactics, "=" )
1984
+ }
1985
+
1976
1986
pub ( crate ) fn rewrite_assign_rhs_with < S : Into < String > , R : Rewrite > (
1977
1987
context : & RewriteContext < ' _ > ,
1978
1988
lhs : S ,
@@ -1981,7 +1991,7 @@ pub(crate) fn rewrite_assign_rhs_with<S: Into<String>, R: Rewrite>(
1981
1991
rhs_tactics : RhsTactics ,
1982
1992
) -> Option < String > {
1983
1993
let lhs = lhs. into ( ) ;
1984
- let rhs = rewrite_rhs_expr ( context, & lhs, ex, shape, rhs_tactics, "=" ) ?;
1994
+ let rhs = rewrite_assign_rhs_expr ( context, & lhs, ex, shape, rhs_tactics) ?;
1985
1995
Some ( lhs + & rhs)
1986
1996
}
1987
1997
@@ -2001,7 +2011,7 @@ pub(crate) fn rewrite_assign_rhs_with_comments<S: Into<String>, R: Rewrite>(
2001
2011
} else {
2002
2012
shape
2003
2013
} ;
2004
- let rhs = rewrite_rhs_expr ( context, & lhs, ex, shape, rhs_tactics, "=" ) ?;
2014
+ let rhs = rewrite_assign_rhs_expr ( context, & lhs, ex, shape, rhs_tactics) ?;
2005
2015
2006
2016
if contains_comment {
2007
2017
let rhs = rhs. trim_start ( ) ;
@@ -2011,35 +2021,6 @@ pub(crate) fn rewrite_assign_rhs_with_comments<S: Into<String>, R: Rewrite>(
2011
2021
}
2012
2022
}
2013
2023
2014
- pub ( crate ) fn rewrite_trait_rhs_with_comments < S : Into < String > , R : Rewrite > (
2015
- context : & RewriteContext < ' _ > ,
2016
- lhs : S ,
2017
- ex : & R ,
2018
- shape : Shape ,
2019
- rhs_tactics : RhsTactics ,
2020
- between_span : Span ,
2021
- allow_extend : bool ,
2022
- ) -> Option < String > {
2023
- let lhs = lhs. into ( ) ;
2024
- let contains_comment = contains_comment ( context. snippet ( between_span) ) ;
2025
-
2026
- let rhs = rewrite_rhs_expr ( context, & lhs, ex, shape, rhs_tactics, ":" ) ?;
2027
-
2028
- if contains_comment {
2029
- let rhs = rhs. trim_start ( ) ;
2030
- combine_strs_with_missing_comments (
2031
- context,
2032
- & lhs,
2033
- & rhs,
2034
- between_span,
2035
- shape. block_left ( context. config . tab_spaces ( ) ) ?,
2036
- allow_extend,
2037
- )
2038
- } else {
2039
- Some ( lhs + & rhs)
2040
- }
2041
- }
2042
-
2043
2024
fn choose_rhs < R : Rewrite > (
2044
2025
context : & RewriteContext < ' _ > ,
2045
2026
expr : & R ,
0 commit comments