]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/rustfmt/src/comment.rs
Rollup merge of #98418 - topjohnwu:macos-dylib, r=jyn514
[rust.git] / src / tools / rustfmt / src / comment.rs
index eb195b1f7628f70037e06e8184ea47c6844befc3..4d565afc1e0266c7544f2a5be85912856c26cd98 100644 (file)
@@ -730,6 +730,10 @@ fn handle_line(
                     {
                         let mut config = self.fmt.config.clone();
                         config.set().wrap_comments(false);
+                        let comment_max_width = config
+                            .doc_comment_code_block_width()
+                            .min(config.max_width());
+                        config.set().max_width(comment_max_width);
                         if let Some(s) =
                             crate::format_code_block(&self.code_block_buffer, &config, false)
                         {