Skip to content

Commit da4d5f8

Browse files
committed
Auto merge of #16413 - Urhengulas:clippy-ci, r=Veykril
internal: Add `clippy` to CI Follow-up to #16401
2 parents 11b401d + 43b1ae0 commit da4d5f8

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
- name: Switch to stable toolchain
9191
run: |
9292
rustup update --no-self-update stable
93-
rustup component add --toolchain stable rust-src
93+
rustup component add --toolchain stable rust-src clippy
9494
rustup default stable
9595
9696
- name: Run analysis-stats on rust-analyzer
@@ -103,6 +103,10 @@ jobs:
103103
RUSTC_BOOTSTRAP: 1
104104
run: target/${{ matrix.target }}/debug/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
105105

106+
- name: clippy
107+
if: matrix.os == 'ubuntu-latest'
108+
run: cargo clippy --all-targets
109+
106110
# Weird targets to catch non-portable code
107111
rust-cross:
108112
if: github.repository == 'rust-lang/rust-analyzer'

crates/hir-expand/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl Attr {
235235
let (path, input) = tt.split_at(path_end);
236236
let path = Interned::new(ModPath::from_tt(db, path)?);
237237

238-
let input = match input.get(0) {
238+
let input = match input.first() {
239239
Some(tt::TokenTree::Subtree(tree)) => {
240240
Some(Interned::new(AttrInput::TokenTree(Box::new(tree.clone()))))
241241
}

crates/hir-expand/src/mod_path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fn convert_path(
232232
ast::PathSegmentKind::SuperKw => {
233233
let mut deg = 1;
234234
let mut next_segment = None;
235-
while let Some(segment) = segments.next() {
235+
for segment in segments.by_ref() {
236236
match segment.kind()? {
237237
ast::PathSegmentKind::SuperKw => deg += 1,
238238
ast::PathSegmentKind::Name(name) => {

crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl<'p> MatchCheckCtx<'p> {
237237
ctor = Or;
238238
// Collect here because `Arena::alloc_extend` panics on reentrancy.
239239
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();
241241
fields = self.pattern_arena.alloc_extend(subpats);
242242
}
243243
}

crates/hir-ty/src/mir/eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@ impl Evaluator<'_> {
17151715
let v: Cow<'_, [u8]> = if size != v.len() {
17161716
// Handle self enum
17171717
if size == 16 && v.len() < 16 {
1718-
Cow::Owned(pad16(&v, false).to_vec())
1718+
Cow::Owned(pad16(v, false).to_vec())
17191719
} else if size < 16 && v.len() == 16 {
17201720
Cow::Borrowed(&v[0..size])
17211721
} else {

crates/hir/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ fn modpath_from_str(link: &str) -> Option<ModPath> {
311311
"self" => PathKind::Super(0),
312312
"super" => {
313313
let mut deg = 1;
314-
while let Some(segment) = parts.next() {
314+
for segment in parts.by_ref() {
315315
if segment == "super" {
316316
deg += 1;
317317
} else {

crates/proc-macro-srv/proc-macro-test/build.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ fn main() {
109109
let mut artifact_path = None;
110110
for message in Message::parse_stream(output.stdout.as_slice()) {
111111
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]));
117117
}
118118
}
119119
}

0 commit comments

Comments
 (0)