@@ -264,7 +264,7 @@ fn strip_default_padding(value: &str) -> String {
264264/// than minimum field width, and the digit zeros are significant content,
265265/// not padding.
266266fn is_nanosecond_specifier ( specifier : & str ) -> bool {
267- specifier. chars ( ) . last ( ) == Some ( 'N' )
267+ specifier. ends_with ( 'N' )
268268}
269269
270270/// Apply modifiers specifically for the `%N` (nanoseconds) specifier.
@@ -286,7 +286,7 @@ fn apply_nanosecond_modifiers(
286286 pad_char : char ,
287287 width : usize ,
288288 explicit_width : bool ,
289- ) -> Result < String , FormatError > {
289+ ) -> String {
290290 let default_width = 9 ;
291291 let precision = if explicit_width { width } else { default_width } ;
292292
@@ -318,7 +318,7 @@ fn apply_nanosecond_modifiers(
318318 // Otherwise (default '0' padding or no flags): result already has the
319319 // right number of zero-padded digits from the truncation/extension above.
320320
321- Ok ( result)
321+ result
322322}
323323
324324/// Apply width and flag modifiers to a formatted value.
@@ -411,7 +411,7 @@ fn apply_modifiers(
411411 // (number of fractional digits), not minimum field width, and the
412412 // digit zeros are significant content rather than padding.
413413 if is_nanosecond_specifier ( specifier) {
414- return apply_nanosecond_modifiers ( & result, no_pad, underscore_flag, pad_char, width, explicit_width) ;
414+ return Ok ( apply_nanosecond_modifiers ( & result, no_pad, underscore_flag, pad_char, width, explicit_width) ) ;
415415 }
416416
417417 // If no_pad flag is active, suppress all padding and return
0 commit comments