Skip to content

Commit 05e9c74

Browse files
committed
Apply clippy to doctest
taiki-e/github-actions@96af4dc ``` error: redundant closure --> src/lib.rs:150:49 | 150 | Box::new(self.child.iter().flat_map(|c| c.method())) as Box<dyn Iterator<Item = _>> | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `Type::method` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D clippy::pedantic` = help: to override `-D clippy::pedantic` add `#[allow(clippy::redundant_closure_for_method_calls)]` error: this loop never actually loops --> src/lib.rs:475:14 | 475 | 1 => loop { | ______________^ 476 | | panic!() 477 | | }, | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop = note: `-D clippy::never-loop` implied by `-D clippy::all` = help: to override `-D clippy::all` add `#[allow(clippy::never_loop)]` error: this `.fold` can be written more succinctly using another method --> src/lib.rs:538:10 | 538 | iter.fold(0, |sum, x| sum + x) | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold = note: `-D clippy::unnecessary-fold` implied by `-D clippy::all` = help: to override `-D clippy::all` add `#[allow(clippy::unnecessary_fold)]` ```
1 parent babf7a7 commit 05e9c74

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/lib.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ struct Type {
142142
143143
impl Type {
144144
#[auto_enum(Iterator)]
145+
# #[allow(clippy::redundant_closure_for_method_calls)]
145146
fn method(&self) -> impl Iterator<Item = ()> + '_ {
146147
if self.child.is_empty() {
147148
Some(()).into_iter()
@@ -468,6 +469,7 @@ You can also skip that branch explicitly by `#[never]` attribute.
468469
use auto_enums::auto_enum;
469470
470471
#[auto_enum(Iterator)]
472+
# #[allow(clippy::never_loop)]
471473
fn foo(x: i32) -> impl Iterator<Item = i32> {
472474
match x {
473475
0 => 1..10,
@@ -527,6 +529,7 @@ function is unnecessary.
527529
# #![feature(proc_macro_hygiene, stmt_expr_attributes)]
528530
use auto_enums::auto_enum;
529531
532+
# #[allow(clippy::unnecessary_fold)]
530533
fn foo(x: i32) -> i32 {
531534
#[auto_enum(Iterator)]
532535
let iter = match x {
@@ -870,10 +873,12 @@ Please be careful if you return another traits with the same name.
870873

871874
#![doc(test(
872875
no_crate_inject,
873-
attr(
874-
deny(warnings, rust_2018_idioms, single_use_lifetimes),
875-
allow(dead_code, unused_variables)
876-
)
876+
attr(allow(
877+
dead_code,
878+
unused_variables,
879+
clippy::undocumented_unsafe_blocks,
880+
clippy::unused_trait_names,
881+
))
877882
))]
878883
#![forbid(unsafe_code)]
879884
#![allow(clippy::doc_link_with_quotes)]

0 commit comments

Comments
 (0)