Skip to content

Commit 1927c2e

Browse files
committed
Auto merge of #13830 - nyurik:lints, r=lnicola
Minor manual cleanup * use default derive * use `strip_prefix` where possible to avoid dup work
2 parents fb0db2a + ec55dd1 commit 1927c2e

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

crates/proc-macro-test/build.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,13 @@ fn main() {
8585

8686
let mut artifact_path = None;
8787
for message in Message::parse_stream(output.stdout.as_slice()) {
88-
match message.unwrap() {
89-
Message::CompilerArtifact(artifact) => {
90-
if artifact.target.kind.contains(&"proc-macro".to_string()) {
91-
let repr = format!("{} {}", name, version);
92-
if artifact.package_id.repr.starts_with(&repr) {
93-
artifact_path = Some(PathBuf::from(&artifact.filenames[0]));
94-
}
88+
if let Message::CompilerArtifact(artifact) = message.unwrap() {
89+
if artifact.target.kind.contains(&"proc-macro".to_string()) {
90+
let repr = format!("{} {}", name, version);
91+
if artifact.package_id.repr.starts_with(&repr) {
92+
artifact_path = Some(PathBuf::from(&artifact.filenames[0]));
9593
}
9694
}
97-
_ => (), // Unknown message
9895
}
9996
}
10097

crates/vfs/src/file_set.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,11 @@ impl FileSetConfig {
140140
}
141141

142142
/// Builder for [`FileSetConfig`].
143+
#[derive(Default)]
143144
pub struct FileSetConfigBuilder {
144145
roots: Vec<Vec<VfsPath>>,
145146
}
146147

147-
impl Default for FileSetConfigBuilder {
148-
fn default() -> Self {
149-
FileSetConfigBuilder { roots: Vec::new() }
150-
}
151-
}
152-
153148
impl FileSetConfigBuilder {
154149
/// Returns the number of sets currently held.
155150
pub fn len(&self) -> usize {

crates/vfs/src/path_interner.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@ use rustc_hash::FxHasher;
99
use crate::{FileId, VfsPath};
1010

1111
/// Structure to map between [`VfsPath`] and [`FileId`].
12+
#[derive(Default)]
1213
pub(crate) struct PathInterner {
1314
map: IndexSet<VfsPath, BuildHasherDefault<FxHasher>>,
1415
}
1516

16-
impl Default for PathInterner {
17-
fn default() -> Self {
18-
Self { map: IndexSet::default() }
19-
}
20-
}
21-
2217
impl PathInterner {
2318
/// Get the id corresponding to `path`.
2419
///

xtask/src/release/changelog.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,9 @@ fn unescape(s: &str) -> String {
113113
fn parse_pr_number(s: &str) -> Option<u32> {
114114
const BORS_PREFIX: &str = "Merge #";
115115
const HOMU_PREFIX: &str = "Auto merge of #";
116-
if s.starts_with(BORS_PREFIX) {
117-
let s = &s[BORS_PREFIX.len()..];
116+
if let Some(s) = s.strip_prefix(BORS_PREFIX) {
118117
s.parse().ok()
119-
} else if s.starts_with(HOMU_PREFIX) {
120-
let s = &s[HOMU_PREFIX.len()..];
118+
} else if let Some(s) = s.strip_prefix(HOMU_PREFIX) {
121119
if let Some(space) = s.find(' ') {
122120
s[..space].parse().ok()
123121
} else {

0 commit comments

Comments
 (0)