File tree Expand file tree Collapse file tree 7 files changed +15
-11
lines changed
proc-macro-srv/proc-macro-test Expand file tree Collapse file tree 7 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 90
90
- name : Switch to stable toolchain
91
91
run : |
92
92
rustup update --no-self-update stable
93
- rustup component add --toolchain stable rust-src
93
+ rustup component add --toolchain stable rust-src clippy
94
94
rustup default stable
95
95
96
96
- name : Run analysis-stats on rust-analyzer
@@ -103,6 +103,10 @@ jobs:
103
103
RUSTC_BOOTSTRAP : 1
104
104
run : target/${{ matrix.target }}/debug/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
105
105
106
+ - name : clippy
107
+ if : matrix.os == 'ubuntu-latest'
108
+ run : cargo clippy --all-targets
109
+
106
110
# Weird targets to catch non-portable code
107
111
rust-cross :
108
112
if : github.repository == 'rust-lang/rust-analyzer'
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ impl Attr {
235
235
let ( path, input) = tt. split_at ( path_end) ;
236
236
let path = Interned :: new ( ModPath :: from_tt ( db, path) ?) ;
237
237
238
- let input = match input. get ( 0 ) {
238
+ let input = match input. first ( ) {
239
239
Some ( tt:: TokenTree :: Subtree ( tree) ) => {
240
240
Some ( Interned :: new ( AttrInput :: TokenTree ( Box :: new ( tree. clone ( ) ) ) ) )
241
241
}
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ fn convert_path(
232
232
ast:: PathSegmentKind :: SuperKw => {
233
233
let mut deg = 1 ;
234
234
let mut next_segment = None ;
235
- while let Some ( segment) = segments. next ( ) {
235
+ for segment in segments. by_ref ( ) {
236
236
match segment. kind ( ) ? {
237
237
ast:: PathSegmentKind :: SuperKw => deg += 1 ,
238
238
ast:: PathSegmentKind :: Name ( name) => {
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ impl<'p> MatchCheckCtx<'p> {
237
237
ctor = Or ;
238
238
// Collect here because `Arena::alloc_extend` panics on reentrancy.
239
239
let subpats: SmallVec < [ _ ; 2 ] > =
240
- pats. into_iter ( ) . map ( |pat| self . lower_pat ( pat) ) . collect ( ) ;
240
+ pats. iter ( ) . map ( |pat| self . lower_pat ( pat) ) . collect ( ) ;
241
241
fields = self . pattern_arena . alloc_extend ( subpats) ;
242
242
}
243
243
}
Original file line number Diff line number Diff line change @@ -1715,7 +1715,7 @@ impl Evaluator<'_> {
1715
1715
let v: Cow < ' _ , [ u8 ] > = if size != v. len ( ) {
1716
1716
// Handle self enum
1717
1717
if size == 16 && v. len ( ) < 16 {
1718
- Cow :: Owned ( pad16 ( & v, false ) . to_vec ( ) )
1718
+ Cow :: Owned ( pad16 ( v, false ) . to_vec ( ) )
1719
1719
} else if size < 16 && v. len ( ) == 16 {
1720
1720
Cow :: Borrowed ( & v[ 0 ..size] )
1721
1721
} else {
Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ fn modpath_from_str(link: &str) -> Option<ModPath> {
311
311
"self" => PathKind :: Super ( 0 ) ,
312
312
"super" => {
313
313
let mut deg = 1 ;
314
- while let Some ( segment) = parts. next ( ) {
314
+ for segment in parts. by_ref ( ) {
315
315
if segment == "super" {
316
316
deg += 1 ;
317
317
} else {
Original file line number Diff line number Diff line change @@ -109,11 +109,11 @@ fn main() {
109
109
let mut artifact_path = None ;
110
110
for message in Message :: parse_stream ( output. stdout . as_slice ( ) ) {
111
111
if let Message :: CompilerArtifact ( artifact) = message. unwrap ( ) {
112
- if artifact. target . kind . contains ( & "proc-macro" . to_string ( ) ) {
113
- if artifact. package_id . repr . starts_with ( & repr) || artifact . package_id . repr == pkgid
114
- {
115
- artifact_path = Some ( PathBuf :: from ( & artifact . filenames [ 0 ] ) ) ;
116
- }
112
+ if artifact. target . kind . contains ( & "proc-macro" . to_string ( ) )
113
+ && ( artifact. package_id . repr . starts_with ( & repr)
114
+ || artifact . package_id . repr == pkgid )
115
+ {
116
+ artifact_path = Some ( PathBuf :: from ( & artifact . filenames [ 0 ] ) ) ;
117
117
}
118
118
}
119
119
}
You can’t perform that action at this time.
0 commit comments