|
1 | 1 | use thiserror::Error;
|
2 | 2 |
|
3 |
| -use ruff_formatter::format_element::tag; |
4 | 3 | use ruff_formatter::prelude::*;
|
5 | 4 | use ruff_formatter::{format, FormatError, Formatted, PrintError, Printed, SourceCode};
|
6 |
| -use ruff_python_ast::node::{AnyNodeRef, AstNode}; |
| 5 | +use ruff_python_ast::node::AstNode; |
7 | 6 | use ruff_python_ast::Mod;
|
8 | 7 | use ruff_python_index::{CommentRanges, CommentRangesBuilder};
|
9 | 8 | use ruff_python_parser::lexer::{lex, LexicalError};
|
10 | 9 | use ruff_python_parser::{parse_tokens, Mode, ParseError};
|
11 | 10 | use ruff_source_file::Locator;
|
12 |
| -use ruff_text_size::TextLen; |
13 | 11 |
|
14 | 12 | use crate::comments::{
|
15 | 13 | dangling_comments, leading_comments, trailing_comments, Comments, SourceComment,
|
@@ -178,45 +176,6 @@ pub fn pretty_comments(formatted: &Formatted<PyFormatContext>, source: &str) ->
|
178 | 176 | )
|
179 | 177 | }
|
180 | 178 |
|
181 |
| -pub(crate) struct NotYetImplementedCustomText<'a> { |
182 |
| - text: &'static str, |
183 |
| - node: AnyNodeRef<'a>, |
184 |
| -} |
185 |
| - |
186 |
| -/// Formats a placeholder for nodes that have not yet been implemented |
187 |
| -pub(crate) fn not_yet_implemented_custom_text<'a, T>( |
188 |
| - text: &'static str, |
189 |
| - node: T, |
190 |
| -) -> NotYetImplementedCustomText<'a> |
191 |
| -where |
192 |
| - T: Into<AnyNodeRef<'a>>, |
193 |
| -{ |
194 |
| - NotYetImplementedCustomText { |
195 |
| - text, |
196 |
| - node: node.into(), |
197 |
| - } |
198 |
| -} |
199 |
| - |
200 |
| -impl Format<PyFormatContext<'_>> for NotYetImplementedCustomText<'_> { |
201 |
| - fn fmt(&self, f: &mut PyFormatter) -> FormatResult<()> { |
202 |
| - f.write_element(FormatElement::Tag(Tag::StartVerbatim( |
203 |
| - tag::VerbatimKind::Verbatim { |
204 |
| - length: self.text.text_len(), |
205 |
| - }, |
206 |
| - ))); |
207 |
| - |
208 |
| - text(self.text).fmt(f)?; |
209 |
| - |
210 |
| - f.write_element(FormatElement::Tag(Tag::EndVerbatim)); |
211 |
| - |
212 |
| - f.context() |
213 |
| - .comments() |
214 |
| - .mark_verbatim_node_comments_formatted(self.node); |
215 |
| - |
216 |
| - Ok(()) |
217 |
| - } |
218 |
| -} |
219 |
| - |
220 | 179 | #[cfg(test)]
|
221 | 180 | mod tests {
|
222 | 181 | use std::path::Path;
|
|
0 commit comments