@@ -153,21 +153,13 @@ fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<
153153 Ok ( MacroInput { fmtstr, args, is_direct_literal } )
154154}
155155
156- fn make_format_args (
157- ecx : & mut ExtCtxt < ' _ > ,
158- input : MacroInput ,
159- append_newline : bool ,
160- ) -> Result < FormatArgs , ( ) > {
156+ fn make_format_args ( ecx : & mut ExtCtxt < ' _ > , input : MacroInput ) -> Result < FormatArgs , ( ) > {
161157 let msg = "format argument must be a string literal" ;
162158 let unexpanded_fmt_span = input. fmtstr . span ;
163159
164160 let MacroInput { fmtstr : efmt, mut args, is_direct_literal } = input;
165161
166162 let ( fmt_str, fmt_style, fmt_span) = match expr_to_spanned_string ( ecx, efmt, msg) {
167- Ok ( mut fmt) if append_newline => {
168- fmt. 0 = Symbol :: intern ( & format ! ( "{}\n " , fmt. 0 ) ) ;
169- fmt
170- }
171163 Ok ( fmt) => fmt,
172164 Err ( err) => {
173165 if let Some ( ( mut err, suggested) ) = err {
@@ -196,13 +188,7 @@ fn make_format_args(
196188
197189 let fmt_str = fmt_str. as_str ( ) ; // for the suggestions below
198190 let fmt_snippet = ecx. source_map ( ) . span_to_snippet ( unexpanded_fmt_span) . ok ( ) ;
199- let mut parser = parse:: Parser :: new (
200- fmt_str,
201- str_style,
202- fmt_snippet,
203- append_newline,
204- parse:: ParseMode :: Format ,
205- ) ;
191+ let mut parser = parse:: Parser :: new ( fmt_str, str_style, fmt_snippet, parse:: ParseMode :: Format ) ;
206192
207193 let mut pieces = Vec :: new ( ) ;
208194 while let Some ( piece) = parser. next ( ) {
@@ -831,16 +817,15 @@ fn report_invalid_references(
831817 e. emit ( ) ;
832818}
833819
834- fn expand_format_args_impl < ' cx > (
820+ pub fn expand_format_args < ' cx > (
835821 ecx : & ' cx mut ExtCtxt < ' _ > ,
836822 mut sp : Span ,
837823 tts : TokenStream ,
838- nl : bool ,
839824) -> Box < dyn base:: MacResult + ' cx > {
840825 sp = ecx. with_def_site_ctxt ( sp) ;
841826 match parse_args ( ecx, sp, tts) {
842827 Ok ( input) => {
843- if let Ok ( format_args) = make_format_args ( ecx, input, nl ) {
828+ if let Ok ( format_args) = make_format_args ( ecx, input) {
844829 MacEager :: expr ( ecx. expr ( sp, ExprKind :: FormatArgs ( P ( format_args) ) ) )
845830 } else {
846831 MacEager :: expr ( DummyResult :: raw_expr ( sp, true ) )
@@ -852,19 +837,3 @@ fn expand_format_args_impl<'cx>(
852837 }
853838 }
854839}
855-
856- pub fn expand_format_args < ' cx > (
857- ecx : & ' cx mut ExtCtxt < ' _ > ,
858- sp : Span ,
859- tts : TokenStream ,
860- ) -> Box < dyn base:: MacResult + ' cx > {
861- expand_format_args_impl ( ecx, sp, tts, false )
862- }
863-
864- pub fn expand_format_args_nl < ' cx > (
865- ecx : & ' cx mut ExtCtxt < ' _ > ,
866- sp : Span ,
867- tts : TokenStream ,
868- ) -> Box < dyn base:: MacResult + ' cx > {
869- expand_format_args_impl ( ecx, sp, tts, true )
870- }
0 commit comments