do not wrap comments in doctest to avoid failing doctest runs
This commit is contained in:
parent
cd8bb50aea
commit
a5043a81be
@ -618,7 +618,7 @@ impl<'a> CommentRewrite<'a> {
|
||||
_ if self.code_block_buffer.is_empty() => String::new(),
|
||||
_ => {
|
||||
let mut config = self.fmt.config.clone();
|
||||
config.set().format_doc_comments(false);
|
||||
config.set().wrap_comments(false);
|
||||
match ::format_code_block(&self.code_block_buffer, &config) {
|
||||
Some(ref s) => trim_custom_comment_prefix(&s.snippet),
|
||||
None => trim_custom_comment_prefix(&self.code_block_buffer),
|
||||
@ -790,16 +790,9 @@ fn trim_custom_comment_prefix(s: &str) -> String {
|
||||
.map(|line| {
|
||||
let left_trimmed = line.trim_left();
|
||||
if left_trimmed.starts_with(RUSTFMT_CUSTOM_COMMENT_PREFIX) {
|
||||
let orig = left_trimmed.trim_left_matches(RUSTFMT_CUSTOM_COMMENT_PREFIX);
|
||||
// due to comment wrapping, a line that was originally behind `#` is split over
|
||||
// multiple lines, which needs then to be prefixed with a `#`
|
||||
if !orig.trim_left().starts_with("# ") {
|
||||
Cow::from(format!("# {}", orig))
|
||||
} else {
|
||||
Cow::from(orig)
|
||||
}
|
||||
left_trimmed.trim_left_matches(RUSTFMT_CUSTOM_COMMENT_PREFIX)
|
||||
} else {
|
||||
Cow::from(line)
|
||||
line
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
@ -1,13 +0,0 @@
|
||||
// rustfmt-max_width: 79
|
||||
// rustfmt-wrap_comments: true
|
||||
|
||||
/// ```rust
|
||||
/// # #![cfg_attr(not(dox), feature(cfg_target_feature, target_feature,
|
||||
/// # stdsimd)not(dox), feature(cfg_target_feature, target_feature,
|
||||
/// # stdsimd))]
|
||||
///
|
||||
/// // Est lectus hendrerit lorem, eget dignissim orci nisl sit amet massa.
|
||||
/// // Etiam volutpat lobortis eros.
|
||||
/// let x = 42;
|
||||
/// ```
|
||||
fn func() {}
|
Loading…
x
Reference in New Issue
Block a user