Skip to content

Commit

Permalink
run cargo fmt --all
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Dec 5, 2023
1 parent 1e6623a commit 887556a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
8 changes: 5 additions & 3 deletions cmd/crates/soroban-spec-json/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ pub struct UnionCase {
impl From<&ScSpecUdtUnionCaseV0> for UnionCase {
fn from(c: &ScSpecUdtUnionCaseV0) -> Self {
let (doc, name, values) = match c {
ScSpecUdtUnionCaseV0::VoidV0(v) => {
(v.doc.to_utf8_string_lossy(), v.name.to_utf8_string_lossy(), vec![])
}
ScSpecUdtUnionCaseV0::VoidV0(v) => (
v.doc.to_utf8_string_lossy(),
v.name.to_utf8_string_lossy(),
vec![],
),
ScSpecUdtUnionCaseV0::TupleV0(t) => (
t.doc.to_utf8_string_lossy(),
t.name.to_utf8_string_lossy(),
Expand Down
7 changes: 5 additions & 2 deletions cmd/crates/soroban-spec-tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@ impl Spec {
};
enum_case == &name.to_utf8_string_lossy()
})
.ok_or_else(|| Error::EnumCase(enum_case.to_string(), union.name.to_utf8_string_lossy()))?;
.ok_or_else(|| {
Error::EnumCase(enum_case.to_string(), union.name.to_utf8_string_lossy())
})?;

let mut res = vec![ScVal::Symbol(ScSymbol(
enum_case.try_into().map_err(Error::Xdr)?,
Expand Down Expand Up @@ -1294,7 +1296,8 @@ impl Spec {
match self.find(name).ok() {
Some(ScSpecEntry::UdtStructV0(strukt)) => {
// Check if a tuple strukt
if !strukt.fields.is_empty() && strukt.fields[0].name.to_utf8_string_lossy() == "0" {
if !strukt.fields.is_empty() && strukt.fields[0].name.to_utf8_string_lossy() == "0"
{
let value_types = strukt
.fields
.iter()
Expand Down
6 changes: 5 additions & 1 deletion cmd/crates/soroban-spec-tools/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ fn indent(s: &str, n: usize) -> String {

fn format_name(lib: &StringM<80>, name: &StringM<60>) -> String {
if lib.len() > 0 {
format!("{}::{}", lib.to_utf8_string_lossy(), name.to_utf8_string_lossy())
format!(
"{}::{}",
lib.to_utf8_string_lossy(),
name.to_utf8_string_lossy()
)
} else {
name.to_utf8_string_lossy()
}
Expand Down
8 changes: 5 additions & 3 deletions cmd/crates/soroban-spec-typescript/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ pub struct UnionCase {
impl From<&ScSpecUdtUnionCaseV0> for UnionCase {
fn from(c: &ScSpecUdtUnionCaseV0) -> Self {
let (doc, name, values) = match c {
ScSpecUdtUnionCaseV0::VoidV0(v) => {
(v.doc.to_utf8_string_lossy(), v.name.to_utf8_string_lossy(), vec![])
}
ScSpecUdtUnionCaseV0::VoidV0(v) => (
v.doc.to_utf8_string_lossy(),
v.name.to_utf8_string_lossy(),
vec![],
),
ScSpecUdtUnionCaseV0::TupleV0(t) => (
t.doc.to_utf8_string_lossy(),
t.name.to_utf8_string_lossy(),
Expand Down
6 changes: 5 additions & 1 deletion cmd/soroban-cli/src/utils/contract_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ fn indent(s: &str, n: usize) -> String {

fn format_name(lib: &StringM<80>, name: &StringM<60>) -> String {
if lib.len() > 0 {
format!("{}::{}", lib.to_utf8_string_lossy(), name.to_utf8_string_lossy())
format!(
"{}::{}",
lib.to_utf8_string_lossy(),
name.to_utf8_string_lossy()
)
} else {
name.to_utf8_string_lossy()
}
Expand Down

0 comments on commit 887556a

Please sign in to comment.