summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/src/attr/doc_comment.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rustfmt/src/attr/doc_comment.rs')
-rw-r--r--src/tools/rustfmt/src/attr/doc_comment.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/rustfmt/src/attr/doc_comment.rs b/src/tools/rustfmt/src/attr/doc_comment.rs
index f653a12a8..25c8158df 100644
--- a/src/tools/rustfmt/src/attr/doc_comment.rs
+++ b/src/tools/rustfmt/src/attr/doc_comment.rs
@@ -2,12 +2,17 @@ use crate::comment::CommentStyle;
use std::fmt::{self, Display};
/// Formats a string as a doc comment using the given [`CommentStyle`].
-#[derive(new)]
pub(super) struct DocCommentFormatter<'a> {
literal: &'a str,
style: CommentStyle<'a>,
}
+impl<'a> DocCommentFormatter<'a> {
+ pub(super) const fn new(literal: &'a str, style: CommentStyle<'a>) -> Self {
+ Self { literal, style }
+ }
+}
+
impl Display for DocCommentFormatter<'_> {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let opener = self.style.opener().trim_end();