aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-03 13:09:10 +0100
committerGitHub <[email protected]>2021-06-03 13:09:10 +0100
commit48ea50bf04a1bd12999bd9e27558ac31988c7228 (patch)
tree64b223398a3b62b8cc4e86239495a5b3e446441a /xtask
parentc7eb19ebf9d42cada8cb532c6b3cb0e11a531b93 (diff)
parenta1e650082b068919f9515330e6d0977c09af190f (diff)
Merge #9124
9124: Apply a few clippy suggestions r=lnicola a=clemenswasser Co-authored-by: Clemens Wasser <[email protected]>
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/codegen/gen_syntax.rs20
-rw-r--r--xtask/src/release/changelog.rs4
-rw-r--r--xtask/src/tidy.rs8
3 files changed, 15 insertions, 17 deletions
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index ba4b24848..b0b9e30db 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -94,18 +94,16 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> Result<String> {
94 support::children(&self.syntax) 94 support::children(&self.syntax)
95 } 95 }
96 } 96 }
97 } else { 97 } else if let Some(token_kind) = field.token_kind() {
98 if let Some(token_kind) = field.token_kind() { 98 quote! {
99 quote! { 99 pub fn #method_name(&self) -> Option<#ty> {
100 pub fn #method_name(&self) -> Option<#ty> { 100 support::token(&self.syntax, #token_kind)
101 support::token(&self.syntax, #token_kind)
102 }
103 } 101 }
104 } else { 102 }
105 quote! { 103 } else {
106 pub fn #method_name(&self) -> Option<#ty> { 104 quote! {
107 support::child(&self.syntax) 105 pub fn #method_name(&self) -> Option<#ty> {
108 } 106 support::child(&self.syntax)
109 } 107 }
110 } 108 }
111 } 109 }
diff --git a/xtask/src/release/changelog.rs b/xtask/src/release/changelog.rs
index ffcae2cf7..2384a746f 100644
--- a/xtask/src/release/changelog.rs
+++ b/xtask/src/release/changelog.rs
@@ -132,7 +132,7 @@ fn parse_changelog_line(s: &str) -> Option<PrInfo> {
132 return Some(PrInfo { kind, message: Some(message) }); 132 return Some(PrInfo { kind, message: Some(message) });
133 } 133 }
134 }; 134 };
135 let res = PrInfo { kind, message }; 135 let res = PrInfo { message, kind };
136 Some(res) 136 Some(res)
137} 137}
138 138
@@ -152,7 +152,7 @@ fn parse_title_line(s: &str) -> PrInfo {
152 PrKind::Skip => None, 152 PrKind::Skip => None,
153 _ => Some(s[prefix.len()..].to_string()), 153 _ => Some(s[prefix.len()..].to_string()),
154 }; 154 };
155 return PrInfo { kind, message }; 155 return PrInfo { message, kind };
156 } 156 }
157 } 157 }
158 PrInfo { kind: PrKind::Other, message: Some(s.to_string()) } 158 PrInfo { kind: PrKind::Other, message: Some(s.to_string()) }
diff --git a/xtask/src/tidy.rs b/xtask/src/tidy.rs
index 6f687a788..618cf12fb 100644
--- a/xtask/src/tidy.rs
+++ b/xtask/src/tidy.rs
@@ -33,7 +33,7 @@ fn check_code_formatting() {
33 let _e = pushenv("RUSTUP_TOOLCHAIN", "stable"); 33 let _e = pushenv("RUSTUP_TOOLCHAIN", "stable");
34 crate::ensure_rustfmt().unwrap(); 34 crate::ensure_rustfmt().unwrap();
35 let res = cmd!("cargo fmt -- --check").run(); 35 let res = cmd!("cargo fmt -- --check").run();
36 if !res.is_ok() { 36 if res.is_err() {
37 let _ = cmd!("cargo fmt").run(); 37 let _ = cmd!("cargo fmt").run();
38 } 38 }
39 res.unwrap() 39 res.unwrap()
@@ -244,19 +244,19 @@ Zlib OR Apache-2.0 OR MIT
244 .map(|it| it.trim()) 244 .map(|it| it.trim())
245 .map(|it| it[r#""license":"#.len()..].trim_matches('"')) 245 .map(|it| it[r#""license":"#.len()..].trim_matches('"'))
246 .collect::<Vec<_>>(); 246 .collect::<Vec<_>>();
247 licenses.sort(); 247 licenses.sort_unstable();
248 licenses.dedup(); 248 licenses.dedup();
249 if licenses != expected { 249 if licenses != expected {
250 let mut diff = String::new(); 250 let mut diff = String::new();
251 251
252 diff += &format!("New Licenses:\n"); 252 diff.push_str("New Licenses:\n");
253 for &l in licenses.iter() { 253 for &l in licenses.iter() {
254 if !expected.contains(&l) { 254 if !expected.contains(&l) {
255 diff += &format!(" {}\n", l) 255 diff += &format!(" {}\n", l)
256 } 256 }
257 } 257 }
258 258
259 diff += &format!("\nMissing Licenses:\n"); 259 diff.push_str("\nMissing Licenses:\n");
260 for &l in expected.iter() { 260 for &l in expected.iter() {
261 if !licenses.contains(&l) { 261 if !licenses.contains(&l) {
262 diff += &format!(" {}\n", l) 262 diff += &format!(" {}\n", l)