Skip to content

Commit ec397c3

Browse files
committed
chore: format
1 parent 05a19df commit ec397c3

3 files changed

Lines changed: 28 additions & 22 deletions

File tree

vectorctl-migration/src/revision.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ impl RevisionGraph {
5656
});
5757
(0..nodes.len()).for_each(|ix| {
5858
if let Some(parent_rev) = nodes[ix].migration.runner.revision().down_revision
59-
&& let Some(&p_ix) = index.get(parent_rev) {
60-
nodes[ix].parent = Some(p_ix);
61-
nodes[p_ix].children.push(ix);
62-
}
59+
&& let Some(&p_ix) = index.get(parent_rev)
60+
{
61+
nodes[ix].parent = Some(p_ix);
62+
nodes[p_ix].children.push(ix);
63+
}
6364
});
6465
let queue_ix = nodes
6566
.iter()

vectorctl-template/src/migration.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,22 @@ impl MigrationTemplate {
4040
impl MigrationTemplateBuilder {
4141
fn validate(&self) -> Result<(), String> {
4242
if let Some(version) = self.version.as_ref()
43-
&& !SEMVER_REGEX.is_match(version) {
44-
return Err(format!("Invalid version: {}", version));
45-
}
43+
&& !SEMVER_REGEX.is_match(version)
44+
{
45+
return Err(format!("Invalid version: {}", version));
46+
}
4647

4748
if let Some(package_name) = self.package_name.as_ref()
48-
&& !STRING_REGEX.is_match(package_name) {
49-
return Err(format!("Invalid package_name: {}", package_name));
50-
}
49+
&& !STRING_REGEX.is_match(package_name)
50+
{
51+
return Err(format!("Invalid package_name: {}", package_name));
52+
}
5153

5254
if let Some(rust_edition) = self.rust_edition.as_ref()
53-
&& !STRING_REGEX.is_match(rust_edition) {
54-
return Err(format!("Invalid rust edition: {}", rust_edition));
55-
}
55+
&& !STRING_REGEX.is_match(rust_edition)
56+
{
57+
return Err(format!("Invalid rust edition: {}", rust_edition));
58+
}
5659

5760
Ok(())
5861
}

vectorctl-template/src/revision.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,19 @@ impl RevisionTemplateBuilder {
7373
}
7474

7575
if let Some(Some(down_revision_id)) = self.down_revision_id.as_ref()
76-
&& !REVISION_ID_REGEX.is_match(down_revision_id) {
77-
return Err(format!(
78-
"down_revision_id `{}` may only contain letters, numbers, dashes or underscores",
79-
down_revision_id
80-
));
81-
}
76+
&& !REVISION_ID_REGEX.is_match(down_revision_id)
77+
{
78+
return Err(format!(
79+
"down_revision_id `{}` may only contain letters, numbers, dashes or underscores",
80+
down_revision_id
81+
));
82+
}
8283

8384
if let Some(Some(message)) = self.message.as_ref()
84-
&& message.trim().is_empty() {
85-
return Err("message cannot be empty".into());
86-
}
85+
&& message.trim().is_empty()
86+
{
87+
return Err("message cannot be empty".into());
88+
}
8789

8890
Ok(())
8991
}

0 commit comments

Comments
 (0)