aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-02 08:38:25 +0000
committerGitHub <[email protected]>2021-03-02 08:38:25 +0000
commit61c73caa307a4972e8cc42a607d6974388d44d59 (patch)
tree9304f986e408de69975529a6b7bc34b2947149af /xtask
parent2183d65c97c2487f93278efa4f4dc66e42706119 (diff)
parent203cfff8265b10fe4b428fb1d9b8166239cedbd4 (diff)
Merge #7836
7836: Check for path dev-dependencies with a version number r=lnicola a=lnicola Closes https://github.com/rust-analyzer/rust-analyzer/pull/7828#issuecomment-788174522. This looks a bit ugly, but at least fixes an issues where we missed target-specific dependencies. Co-authored-by: LaurenČ›iu Nicola <[email protected]>
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/tidy.rs43
1 files changed, 33 insertions, 10 deletions
diff --git a/xtask/src/tidy.rs b/xtask/src/tidy.rs
index 63116ec6b..349ca14d0 100644
--- a/xtask/src/tidy.rs
+++ b/xtask/src/tidy.rs
@@ -101,21 +101,44 @@ fn cargo_files_are_tidy() {
101 let mut section = None; 101 let mut section = None;
102 for (line_no, text) in read_file(&cargo).unwrap().lines().enumerate() { 102 for (line_no, text) in read_file(&cargo).unwrap().lines().enumerate() {
103 let text = text.trim(); 103 let text = text.trim();
104 if text.starts_with("[") { 104 if text.starts_with('[') {
105 if !text.ends_with(']') {
106 panic!(
107 "\nplease don't add comments or trailing whitespace in section lines.\n\
108 {}:{}\n",
109 cargo.display(),
110 line_no + 1
111 )
112 }
105 section = Some(text); 113 section = Some(text);
106 continue; 114 continue;
107 } 115 }
108 if !section.map(|it| it.starts_with("[dependencies")).unwrap_or(false) { 116 let text: String = text.split_whitespace().collect();
117 if !text.contains("path=") {
109 continue; 118 continue;
110 } 119 }
111 let text: String = text.split_whitespace().collect(); 120 match section {
112 if text.contains("path=") && !text.contains("version") { 121 Some(s) if s.contains("dev-dependencies") => {
113 panic!( 122 if text.contains("version") {
114 "\ncargo internal dependencies should have version.\n\ 123 panic!(
115 {}:{}\n", 124 "\ncargo internal dev-dependencies should not have a version.\n\
116 cargo.display(), 125 {}:{}\n",
117 line_no + 1 126 cargo.display(),
118 ) 127 line_no + 1
128 );
129 }
130 }
131 Some(s) if s.contains("dependencies") => {
132 if !text.contains("version") {
133 panic!(
134 "\ncargo internal dependencies should have a version.\n\
135 {}:{}\n",
136 cargo.display(),
137 line_no + 1
138 );
139 }
140 }
141 _ => {}
119 } 142 }
120 } 143 }
121 } 144 }