Skip to content

Commit

Permalink
remove not_yet_implemented_custom_text function
Browse files Browse the repository at this point in the history
  • Loading branch information
LaBatata101 committed Aug 27, 2023
1 parent 25e5224 commit 53efe4d
Showing 1 changed file with 1 addition and 42 deletions.
43 changes: 1 addition & 42 deletions crates/ruff_python_formatter/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
use thiserror::Error;

use ruff_formatter::format_element::tag;
use ruff_formatter::prelude::*;
use ruff_formatter::{format, FormatError, Formatted, PrintError, Printed, SourceCode};
use ruff_python_ast::node::{AnyNodeRef, AstNode};
use ruff_python_ast::node::AstNode;
use ruff_python_ast::Mod;
use ruff_python_index::{CommentRanges, CommentRangesBuilder};
use ruff_python_parser::lexer::{lex, LexicalError};
use ruff_python_parser::{parse_tokens, Mode, ParseError};
use ruff_source_file::Locator;
use ruff_text_size::TextLen;

use crate::comments::{
dangling_comments, leading_comments, trailing_comments, Comments, SourceComment,
Expand Down Expand Up @@ -167,45 +165,6 @@ pub fn format_node<'a>(
Ok(formatted)
}

pub(crate) struct NotYetImplementedCustomText<'a> {
text: &'static str,
node: AnyNodeRef<'a>,
}

/// Formats a placeholder for nodes that have not yet been implemented
pub(crate) fn not_yet_implemented_custom_text<'a, T>(
text: &'static str,
node: T,
) -> NotYetImplementedCustomText<'a>
where
T: Into<AnyNodeRef<'a>>,
{
NotYetImplementedCustomText {
text,
node: node.into(),
}
}

impl Format<PyFormatContext<'_>> for NotYetImplementedCustomText<'_> {
fn fmt(&self, f: &mut PyFormatter) -> FormatResult<()> {
f.write_element(FormatElement::Tag(Tag::StartVerbatim(
tag::VerbatimKind::Verbatim {
length: self.text.text_len(),
},
)));

text(self.text).fmt(f)?;

f.write_element(FormatElement::Tag(Tag::EndVerbatim));

f.context()
.comments()
.mark_verbatim_node_comments_formatted(self.node);

Ok(())
}
}

#[cfg(test)]
mod tests {
use std::path::Path;
Expand Down

0 comments on commit 53efe4d

Please sign in to comment.