Skip to content

Commit a0582cd

Browse files
committed
rustfmt the publish script
1 parent d9c4164 commit a0582cd

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

publish.rs

+28-23
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const CRATES_TO_PUBLISH: &[&str] = &[
4141
const CRATES_TO_AVOID_PUBLISH: &[&str] = &[
4242
// We'll publish these when they're ready one day
4343
"wasm-bindgen-typescript",
44-
4544
// These are internal crates, unlikely to ever be published
4645
"ui-tests",
4746
"sample",
@@ -62,7 +61,8 @@ fn main() {
6261
find_crates("crates".as_ref(), &mut crates);
6362
find_crates("examples".as_ref(), &mut crates);
6463

65-
let pos = CRATES_TO_PUBLISH.iter()
64+
let pos = CRATES_TO_PUBLISH
65+
.iter()
6666
.chain(CRATES_TO_AVOID_PUBLISH)
6767
.enumerate()
6868
.map(|(i, c)| (*c, i))
@@ -89,7 +89,8 @@ fn main() {
8989
fn find_crates(dir: &Path, dst: &mut Vec<Crate>) {
9090
if dir.join("Cargo.toml").exists() {
9191
let krate = read_crate(&dir.join("Cargo.toml"));
92-
if CRATES_TO_PUBLISH.iter()
92+
if CRATES_TO_PUBLISH
93+
.iter()
9394
.chain(CRATES_TO_AVOID_PUBLISH)
9495
.any(|c| krate.name == *c)
9596
{
@@ -114,16 +115,20 @@ fn read_crate(manifest: &Path) -> Crate {
114115
let mut version = None;
115116
for line in fs::read_to_string(manifest).unwrap().lines() {
116117
if name.is_none() && line.starts_with("name = \"") {
117-
name = Some(line.replace("name = \"", "")
118-
.replace("\"", "")
119-
.trim()
120-
.to_string());
118+
name = Some(
119+
line.replace("name = \"", "")
120+
.replace("\"", "")
121+
.trim()
122+
.to_string(),
123+
);
121124
}
122125
if version.is_none() && line.starts_with("version = \"") {
123-
version = Some(line.replace("version = \"", "")
124-
.replace("\"", "")
125-
.trim()
126-
.to_string());
126+
version = Some(
127+
line.replace("version = \"", "")
128+
.replace("\"", "")
129+
.trim()
130+
.to_string(),
131+
);
127132
}
128133
}
129134
let name = name.unwrap();
@@ -150,10 +155,10 @@ fn bump_version(krate: &Crate, crates: &[Crate]) {
150155
let mut rewritten = false;
151156
if line.starts_with("version =") {
152157
if CRATES_TO_PUBLISH.contains(&&krate.name[..]) {
153-
println!("bump `{}` {} => {}",
154-
krate.name,
155-
krate.version,
156-
krate.next_version);
158+
println!(
159+
"bump `{}` {} => {}",
160+
krate.name, krate.version, krate.next_version
161+
);
157162
new_manifest.push_str(&line.replace(&krate.version, &krate.next_version));
158163
rewritten = true;
159164
}
@@ -167,20 +172,20 @@ fn bump_version(krate: &Crate, crates: &[Crate]) {
167172

168173
for other in crates {
169174
if !is_deps || !line.starts_with(&format!("{} ", other.name)) {
170-
continue
175+
continue;
171176
}
172177
if !line.contains(&other.version) {
173178
if !line.contains("version =") {
174-
continue
179+
continue;
175180
}
176-
panic!("{:?} has a dep on {} but doesn't list version {}",
177-
krate.manifest,
178-
other.name,
179-
other.version);
181+
panic!(
182+
"{:?} has a dep on {} but doesn't list version {}",
183+
krate.manifest, other.name, other.version
184+
);
180185
}
181186
rewritten = true;
182187
new_manifest.push_str(&line.replace(&other.version, &other.next_version));
183-
break
188+
break;
184189
}
185190
if !rewritten {
186191
new_manifest.push_str(line);
@@ -200,7 +205,7 @@ fn bump(version: &str) -> String {
200205

201206
fn publish(krate: &Crate) {
202207
if !CRATES_TO_PUBLISH.iter().any(|s| *s == krate.name) {
203-
return
208+
return;
204209
}
205210
if krate.name == "wasm-bindgen" {
206211
println!("ABOUT TO PUBLISH wasm-bindgen");

0 commit comments

Comments
 (0)