Skip to content

Commit 83a3f5d

Browse files
committed
Run cargo fmt --all
1 parent 3aa803c commit 83a3f5d

File tree

5 files changed

+58
-45
lines changed

5 files changed

+58
-45
lines changed

crates/cli-support/src/js/rust2js.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,8 @@ impl<'a, 'b> Rust2Js<'a, 'b> {
11741174
//
11751175
// But for now, we just bounce wasm -> js -> wasm because it is
11761176
// easy.
1177-
self.cx.require_internal_export("__wbindgen_anyref_heap_live_count_impl")?;
1177+
self.cx
1178+
.require_internal_export("__wbindgen_anyref_heap_live_count_impl")?;
11781179
"wasm.__wbindgen_anyref_heap_live_count_impl()".into()
11791180
} else {
11801181
self.cx.expose_global_heap();

crates/cli-support/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use walrus::Module;
1111

1212
mod anyref;
1313
mod decode;
14-
mod intrinsic;
1514
mod descriptor;
1615
mod descriptors;
16+
mod intrinsic;
1717
mod js;
1818
pub mod wasm2es6js;
1919
mod webidl;
@@ -337,7 +337,10 @@ impl Bindgen {
337337
let (js, ts) = {
338338
let mut cx = js::Context::new(&mut module, self)?;
339339

340-
let aux = cx.module.customs.delete_typed::<webidl::WasmBindgenAux>()
340+
let aux = cx
341+
.module
342+
.customs
343+
.delete_typed::<webidl::WasmBindgenAux>()
341344
.expect("aux section should be present");
342345
cx.generate(&aux)?;
343346

@@ -346,10 +349,7 @@ impl Bindgen {
346349
for (identifier, list) in aux.snippets.iter() {
347350
for (i, js) in list.iter().enumerate() {
348351
let name = format!("inline{}.js", i);
349-
let path = out_dir
350-
.join("snippets")
351-
.join(identifier)
352-
.join(name);
352+
let path = out_dir.join("snippets").join(identifier).join(name);
353353
fs::create_dir_all(path.parent().unwrap())?;
354354
fs::write(&path, js)
355355
.with_context(|_| format!("failed to write `{}`", path.display()))?;

crates/cli/src/bin/wasm-bindgen-test-runner/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ fn rmain() -> Result<(), Error> {
7171
// that any exported function with the prefix `__wbg_test` is a test we need
7272
// to execute.
7373
let wasm = fs::read(&wasm_file_to_test).context("failed to read wasm file")?;
74-
let mut wasm = walrus::Module::from_buffer(&wasm).context("failed to deserialize wasm module")?;
74+
let mut wasm =
75+
walrus::Module::from_buffer(&wasm).context("failed to deserialize wasm module")?;
7576
let mut tests = Vec::new();
7677

7778
for export in wasm.exports.iter() {
Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,68 @@
11
use wasm_bindgen::prelude::*;
22

33
#[wasm_bindgen]
4-
pub struct ColorWithGetter { r: f64, _g: f64, _b: f64, _a: u8 }
4+
pub struct ColorWithGetter {
5+
r: f64,
6+
_g: f64,
7+
_b: f64,
8+
_a: u8,
9+
}
510

611
#[wasm_bindgen]
712
impl ColorWithGetter {
8-
#[wasm_bindgen(getter)]
9-
pub fn r(&self) -> f64 {
10-
self.r
11-
}
13+
#[wasm_bindgen(getter)]
14+
pub fn r(&self) -> f64 {
15+
self.r
16+
}
1217
}
1318

1419
#[wasm_bindgen]
15-
pub struct ColorWithSetter { r: f64, _g: f64, _b: f64, a: u8 }
20+
pub struct ColorWithSetter {
21+
r: f64,
22+
_g: f64,
23+
_b: f64,
24+
a: u8,
25+
}
1626

1727
#[wasm_bindgen]
1828
impl ColorWithSetter {
19-
#[wasm_bindgen(setter)]
20-
pub fn set_r(&mut self, r: f64) {
21-
self.r = r;
22-
self.a = if self.r > 1.0 {
23-
255
24-
}
25-
else if self.r < 0.0 {
26-
0
29+
#[wasm_bindgen(setter)]
30+
pub fn set_r(&mut self, r: f64) {
31+
self.r = r;
32+
self.a = if self.r > 1.0 {
33+
255
34+
} else if self.r < 0.0 {
35+
0
36+
} else {
37+
(self.r * 255.0) as u8
38+
};
2739
}
28-
else {
29-
(self.r * 255.0) as u8
30-
};
31-
}
3240
}
3341

3442
#[wasm_bindgen]
35-
pub struct ColorWithGetterAndSetter { r: f64, _g: f64, _b: f64, a: u8 }
43+
pub struct ColorWithGetterAndSetter {
44+
r: f64,
45+
_g: f64,
46+
_b: f64,
47+
a: u8,
48+
}
3649

3750
#[wasm_bindgen]
3851
impl ColorWithGetterAndSetter {
39-
#[wasm_bindgen(getter)]
40-
pub fn r(&self) -> f64 {
41-
self.r
42-
}
43-
44-
#[wasm_bindgen(setter)]
45-
pub fn set_r(&mut self, r: f64) {
46-
self.r = r;
47-
self.a = if self.r > 1.0 {
48-
255
52+
#[wasm_bindgen(getter)]
53+
pub fn r(&self) -> f64 {
54+
self.r
4955
}
50-
else if self.r < 0.0 {
51-
0
56+
57+
#[wasm_bindgen(setter)]
58+
pub fn set_r(&mut self, r: f64) {
59+
self.r = r;
60+
self.a = if self.r > 1.0 {
61+
255
62+
} else if self.r < 0.0 {
63+
0
64+
} else {
65+
(self.r * 255.0) as u8
66+
};
5267
}
53-
else {
54-
(self.r * 255.0) as u8
55-
};
56-
}
57-
}
68+
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ pub mod __rt {
10801080
pub fn take_last_exception() -> Result<(), super::JsValue> {
10811081
unsafe {
10821082
let ret = if GLOBAL_EXNDATA[0] == 1 {
1083-
Err(super::JsValue:: _new(GLOBAL_EXNDATA[1]))
1083+
Err(super::JsValue::_new(GLOBAL_EXNDATA[1]))
10841084
} else {
10851085
Ok(())
10861086
};

0 commit comments

Comments
 (0)