(&self, f: &mut PyFormatter)
| 41 | |
| 42 | impl Format<PyFormatContext<'_>> for FormatImplicitConcatenatedString<'_> { |
| 43 | fn fmt(&self, f: &mut PyFormatter) -> FormatResult<()> { |
| 44 | let flat = FormatImplicitConcatenatedStringFlat::new(self.string, f.context()); |
| 45 | let expanded = FormatImplicitConcatenatedStringExpanded::new( |
| 46 | self.string, |
| 47 | if flat.is_some() { |
| 48 | ImplicitConcatenatedLayout::MaybeFlat |
| 49 | } else { |
| 50 | ImplicitConcatenatedLayout::Multipart |
| 51 | }, |
| 52 | ); |
| 53 | |
| 54 | // If the string can be joined, try joining the implicit concatenated string into a single string |
| 55 | // if it fits on the line. Otherwise, parenthesize the string parts and format each part on its |
| 56 | // own line. |
| 57 | if let Some(flat) = flat { |
| 58 | write!( |
| 59 | f, |
| 60 | [if_group_fits_on_line(&flat), if_group_breaks(&expanded)] |
| 61 | ) |
| 62 | } else { |
| 63 | expanded.fmt(f) |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /// Formats an implicit concatenated string where parts are separated by a space or line break. |
nothing calls this directly
no test coverage detected