Skip to content

Commit dc0bf81

Browse files
committed
rustfmt
1 parent b67a6ed commit dc0bf81

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

crates/target_rust/src/lib.rs

+9-19
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
use jtd_codegen::error::Error;
12
use jtd_codegen::target::{self, inflect, metadata};
23
use jtd_codegen::Result;
34
use lazy_static::lazy_static;
45
use serde_json::Value;
56
use std::collections::{BTreeMap, BTreeSet};
67
use std::io::Write;
7-
use jtd_codegen::error::Error;
88

99
lazy_static! {
1010
static ref KEYWORDS: BTreeSet<String> = include_str!("keywords")
@@ -238,9 +238,7 @@ impl jtd_codegen::target::Target for Target {
238238
let mut derives = vec!["Serialize", "Deserialize"];
239239

240240
if let Some(s) = metadata.get("rustCustomDerive").and_then(|v| v.as_str()) {
241-
derives.extend(
242-
s.split(",")
243-
);
241+
derives.extend(s.split(","));
244242
}
245243

246244
state
@@ -251,29 +249,21 @@ impl jtd_codegen::target::Target for Target {
251249

252250
let mut custom_use = Vec::<&str>::new();
253251
if let Some(s) = metadata.get("rustCustomUse").and_then(|v| v.as_str()) {
254-
custom_use.extend(
255-
s.split(";")
256-
);
252+
custom_use.extend(s.split(";"));
257253
}
258-
for cu in custom_use
259-
{
254+
for cu in custom_use {
260255
// custom::path::{import,export} or custom::path::single
261256
let mut use_imports = Vec::<&str>::new();
262257
let mut path_parts = cu.split("::").collect::<Vec<&str>>();
263258
let mut last_part = path_parts.pop().unwrap();
264259
// If there are no path_parts or the last part was "", panic!
265260
if path_parts.len() < 1 || last_part.trim().len() < 1 {
266-
return Err(
267-
Error::Io(
268-
std::io::Error::new(
269-
std::io::ErrorKind::Other,
270-
format!("Invalid custom use statement: {:?}", cu)
271-
)
272-
)
273-
);
261+
return Err(Error::Io(std::io::Error::new(
262+
std::io::ErrorKind::Other,
263+
format!("Invalid custom use statement: {:?}", cu),
264+
)));
274265
}
275-
if last_part.starts_with('{')
276-
{
266+
if last_part.starts_with('{') {
277267
// Strip the first/last chars and split
278268
last_part = &last_part[1..last_part.len() - 1];
279269
use_imports.extend(last_part.split(","))

0 commit comments

Comments
 (0)