diff --git a/serde-generate/runtime/swift/Sources/Serde/BcsDeserializer.swift b/serde-generate/runtime/swift/Sources/Serde/BcsDeserializer.swift index dcca4c8f8..66ce7fad7 100644 --- a/serde-generate/runtime/swift/Sources/Serde/BcsDeserializer.swift +++ b/serde-generate/runtime/swift/Sources/Serde/BcsDeserializer.swift @@ -2,8 +2,6 @@ import Foundation -import Foundation - public enum BcsDeserializerError: Error { case bcsException(issue: String) } diff --git a/serde-generate/runtime/swift/Sources/Serde/BinarySerializer.swift b/serde-generate/runtime/swift/Sources/Serde/BinarySerializer.swift index 66a3c462c..2e38d986d 100644 --- a/serde-generate/runtime/swift/Sources/Serde/BinarySerializer.swift +++ b/serde-generate/runtime/swift/Sources/Serde/BinarySerializer.swift @@ -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 diff --git a/serde-generate/src/swift.rs b/serde-generate/src/swift.rs index d86dad7ee..b4323aed8 100644 --- a/serde-generate/src/swift.rs +++ b/serde-generate/src/swift.rs @@ -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)?; @@ -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(), @@ -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)?; } @@ -805,7 +805,7 @@ switch index {{"#, }) .collect(), Enum(variants) => { - self.output_enum_container(name, &variants)?; + self.output_enum_container(name, variants)?; return Ok(()); } };