Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
[swift] clean up + clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2bd committed Nov 1, 2021
1 parent 3f5698e commit f2f180e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import Foundation

import Foundation

public enum BcsDeserializerError: Error {
case bcsException(issue: String)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Facebook, Inc. and its affiliates.

import Foundation

public enum BinarySerializerError: Error {
case serializationException(issue: String)
}

import Foundation

public class BinarySerializer: Serializer {
public var output = OutputStream.toMemory()
private var containerDepthBudget: Int64
Expand Down
8 changes: 4 additions & 4 deletions serde-generate/src/swift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ return obj

fn output_variant(&mut self, name: &str, variant: &VariantFormat) -> Result<()> {
use VariantFormat::*;
self.output_comment(&name)?;
self.output_comment(name)?;
match variant {
Unit => {
writeln!(self.out, "case {}", name)?;
Expand Down Expand Up @@ -507,7 +507,7 @@ return obj
.enumerate()
.map(|(i, f)| Named {
name: format!("x{}", i),
value: f.clone(),
value: f,
})
.collect(),
Struct(fields) => fields.clone(),
Expand Down Expand Up @@ -657,7 +657,7 @@ public static func {1}Deserialize(input: [UInt8]) throws -> {0} {{
writeln!(self.out, "indirect public enum {} {{", name)?;
self.current_namespace.push(name.to_string());
self.out.indent();
for (_, variant) in variants {
for variant in variants.values() {
self.output_variant(&variant.name, &variant.value)?;
}

Expand Down Expand Up @@ -805,7 +805,7 @@ switch index {{"#,
})
.collect(),
Enum(variants) => {
self.output_enum_container(name, &variants)?;
self.output_enum_container(name, variants)?;
return Ok(());
}
};
Expand Down

0 comments on commit f2f180e

Please sign in to comment.