From 299d7be132584b17c17dd72309605131a8ed9c21 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Wed, 21 Dec 2016 10:00:13 +0100 Subject: [PATCH] rustfmt fallout in doc comments --- clippy_lints/src/collapsible_if.rs | 8 +++---- clippy_lints/src/utils/mod.rs | 38 +++++++++++++++++------------- clippy_lints/src/utils/sugg.rs | 4 ++-- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/clippy_lints/src/collapsible_if.rs b/clippy_lints/src/collapsible_if.rs index 83b87dc74b0..85bd419df73 100644 --- a/clippy_lints/src/collapsible_if.rs +++ b/clippy_lints/src/collapsible_if.rs @@ -2,7 +2,7 @@ //! //! For example, the lint would catch: //! -//! ```rust +//! ```rust,ignore //! if x { //! if y { //! println!("Hello world"); @@ -28,7 +28,7 @@ /// **Known problems:** None. /// /// **Example:** -/// ```rust +/// ```rust,ignore /// if x { /// if y { /// … @@ -48,7 +48,7 @@ /// /// Should be written: /// -/// ```rust +/// ```rust.ignore /// if x && y { /// … /// } @@ -140,7 +140,7 @@ fn check_collapsible_no_if_let(cx: &EarlyContext, expr: &ast::Expr, check: &ast: }} } -/// If the block contains only one expression, returns it. +/// If the block contains only one expression, return it. fn expr_block(block: &ast::Block) -> Option<&ast::Expr> { let mut it = block.stmts.iter(); diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index e56574c9ba9..f31ce3706eb 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -35,23 +35,27 @@ /// Produce a nested chain of if-lets and ifs from the patterns: /// -/// if_let_chain! {[ -/// let Some(y) = x, -/// y.len() == 2, -/// let Some(z) = y, -/// ], { -/// block -/// }} +/// ```rust,ignore +/// if_let_chain! {[ +/// let Some(y) = x, +/// y.len() == 2, +/// let Some(z) = y, +/// ], { +/// block +/// }} +/// ``` /// /// becomes /// -/// if let Some(y) = x { -/// if y.len() == 2 { -/// if let Some(z) = y { -/// block -/// } +/// ```rust,ignore +/// if let Some(y) = x { +/// if y.len() == 2 { +/// if let Some(z) = y { +/// block /// } /// } +/// } +/// ``` #[macro_export] macro_rules! if_let_chain { ([let $pat:pat = $expr:expr, $($tt:tt)+], $block:block) => { @@ -135,7 +139,7 @@ fn in_macro_ext<'a, T: LintContext<'a>>(cx: &T, opt_info: Option<&ExpnInfo>) -> /// Check if a `DefId`'s path matches the given absolute type path usage. /// /// # Examples -/// ``` +/// ```rust,ignore /// match_def_path(cx, id, &["core", "option", "Option"]) /// ``` /// @@ -229,7 +233,7 @@ pub fn single_segment_path(path: &QPath) -> Option<&PathSegment> { /// Match a `Path` against a slice of segment string literals. /// /// # Examples -/// ``` +/// ```rust,ignore /// match_path(path, &["std", "rt", "begin_unwind"]) /// ``` pub fn match_path(path: &QPath, segments: &[&str]) -> bool { @@ -254,7 +258,7 @@ pub fn match_path_old(path: &Path, segments: &[&str]) -> bool { /// Match a `Path` against a slice of segment string literals, e.g. /// /// # Examples -/// ``` +/// ```rust,ignore /// match_path(path, &["std", "rt", "begin_unwind"]) /// ``` pub fn match_path_ast(path: &ast::Path, segments: &[&str]) -> bool { @@ -371,7 +375,7 @@ pub fn get_item_name(cx: &LateContext, expr: &Expr) -> Option { /// Convert a span to a code snippet if available, otherwise use default. /// /// # Example -/// ``` +/// ```rust,ignore /// snippet(cx, expr.span, "..") /// ``` pub fn snippet<'a, 'b, T: LintContext<'b>>(cx: &T, span: Span, default: &'a str) -> Cow<'a, str> { @@ -388,7 +392,7 @@ pub fn snippet_opt<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Option /// things which need to be printed as such. /// /// # Example -/// ``` +/// ```rust,ignore /// snippet(cx, expr.span, "..") /// ``` pub fn snippet_block<'a, 'b, T: LintContext<'b>>(cx: &T, span: Span, default: &'a str) -> Cow<'a, str> { diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index f3f0337a017..e4938f1c1ed 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -398,7 +398,7 @@ pub trait DiagnosticBuilderExt<'a, T: LintContext<'a>> { /// /// # Example /// - /// ```rust + /// ```rust,ignore /// db.suggest_item_with_attr(cx, item, "#[derive(Default)]"); /// ``` fn suggest_item_with_attr(&mut self, cx: &T, item: Span, msg: &str, attr: &D); @@ -409,7 +409,7 @@ pub trait DiagnosticBuilderExt<'a, T: LintContext<'a>> { /// /// # Example /// - /// ```rust + /// ```rust,ignore /// db.suggest_prepend_item(cx, item, /// "fn foo() { /// bar(); -- 2.44.0