From 937b93224db3cf1f19cb1e931de4d9e65443b0d1 Mon Sep 17 00:00:00 2001 From: Jasperav Date: Sat, 12 Nov 2022 16:12:53 +0100 Subject: [PATCH] Rename method to serializedBytes (#67) --- GRDBPerformance/GRDBPerformance/Generated/DbUser.swift | 4 ++-- .../GRDBPerformance/Generated/DynamicQueries.swift | 8 ++++---- GRDBPerformance/GRDBPerformance/Util.swift | 4 ++-- Parser/generated/DbUser.swift | 4 ++-- Parser/generated/DynamicQueries.swift | 8 ++++---- Parser/src/dynamic_queries/return_type.rs | 2 +- Parser/src/format_swift_code.rs | 4 ++-- Parser/src/main.rs | 6 +++--- Parser/src/swift_property.rs | 2 +- new_version/src/main.rs | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/GRDBPerformance/GRDBPerformance/Generated/DbUser.swift b/GRDBPerformance/GRDBPerformance/Generated/DbUser.swift index c0fa7d0..4e711f3 100644 --- a/GRDBPerformance/GRDBPerformance/Generated/DbUser.swift +++ b/GRDBPerformance/GRDBPerformance/Generated/DbUser.swift @@ -34,7 +34,7 @@ public struct DbUser: FetchableRecord, PersistableRecord, Codable, Equatable, Ha public var bool: Bool public private(set) var serializedInfo: Data public func serializedInfoAutoConvert() -> SerializedInfo { - try! SerializedInfo(serializedData: serializedInfo) + try! SerializedInfo(serializedBytes: serializedInfo) } public mutating func serializedInfoAutoSet(serializedInfo: SerializedInfo) { @@ -46,7 +46,7 @@ public struct DbUser: FetchableRecord, PersistableRecord, Codable, Equatable, Ha guard let serializedInfoNullable = serializedInfoNullable else { return nil } - return try! SerializedInfo(serializedData: serializedInfoNullable) + return try! SerializedInfo(serializedBytes: serializedInfoNullable) } public mutating func serializedInfoNullableAutoSet(serializedInfoNullable: SerializedInfo?) { diff --git a/GRDBPerformance/GRDBPerformance/Generated/DynamicQueries.swift b/GRDBPerformance/GRDBPerformance/Generated/DynamicQueries.swift index 704fa00..15977ed 100644 --- a/GRDBPerformance/GRDBPerformance/Generated/DynamicQueries.swift +++ b/GRDBPerformance/GRDBPerformance/Generated/DynamicQueries.swift @@ -367,12 +367,12 @@ public extension DbUser { public var gen0: SerializedInfo public var gen1: SerializedInfo? public init(row: Row) { - gen0 = try! SerializedInfo(serializedData: row[0]) + gen0 = try! SerializedInfo(serializedBytes: row[0]) gen1 = { if row.hasNull(atIndex: 1) { return nil } else { - return try! SerializedInfo(serializedData: row[1]) + return try! SerializedInfo(serializedBytes: row[1]) } }() } @@ -426,12 +426,12 @@ public extension DbUser { public var gen0: SerializedInfo public var gen1: SerializedInfo? public init(row: Row) { - gen0 = try! SerializedInfo(serializedData: row[0]) + gen0 = try! SerializedInfo(serializedBytes: row[0]) gen1 = { if row.hasNull(atIndex: 1) { return nil } else { - return try! SerializedInfo(serializedData: row[1]) + return try! SerializedInfo(serializedBytes: row[1]) } }() } diff --git a/GRDBPerformance/GRDBPerformance/Util.swift b/GRDBPerformance/GRDBPerformance/Util.swift index 09861ac..cf639e6 100644 --- a/GRDBPerformance/GRDBPerformance/Util.swift +++ b/GRDBPerformance/GRDBPerformance/Util.swift @@ -4,8 +4,8 @@ import GRDB public enum SerializedInfo: Equatable { case data(String) - public init(serializedData: Data) { - self = SerializedInfo.data(String(decoding: serializedData, as: UTF8.self)) + public init(serializedBytes: Data) { + self = SerializedInfo.data(String(decoding: serializedBytes, as: UTF8.self)) } public func serializedData() -> Data { diff --git a/Parser/generated/DbUser.swift b/Parser/generated/DbUser.swift index c0fa7d0..4e711f3 100644 --- a/Parser/generated/DbUser.swift +++ b/Parser/generated/DbUser.swift @@ -34,7 +34,7 @@ public struct DbUser: FetchableRecord, PersistableRecord, Codable, Equatable, Ha public var bool: Bool public private(set) var serializedInfo: Data public func serializedInfoAutoConvert() -> SerializedInfo { - try! SerializedInfo(serializedData: serializedInfo) + try! SerializedInfo(serializedBytes: serializedInfo) } public mutating func serializedInfoAutoSet(serializedInfo: SerializedInfo) { @@ -46,7 +46,7 @@ public struct DbUser: FetchableRecord, PersistableRecord, Codable, Equatable, Ha guard let serializedInfoNullable = serializedInfoNullable else { return nil } - return try! SerializedInfo(serializedData: serializedInfoNullable) + return try! SerializedInfo(serializedBytes: serializedInfoNullable) } public mutating func serializedInfoNullableAutoSet(serializedInfoNullable: SerializedInfo?) { diff --git a/Parser/generated/DynamicQueries.swift b/Parser/generated/DynamicQueries.swift index 704fa00..15977ed 100644 --- a/Parser/generated/DynamicQueries.swift +++ b/Parser/generated/DynamicQueries.swift @@ -367,12 +367,12 @@ public extension DbUser { public var gen0: SerializedInfo public var gen1: SerializedInfo? public init(row: Row) { - gen0 = try! SerializedInfo(serializedData: row[0]) + gen0 = try! SerializedInfo(serializedBytes: row[0]) gen1 = { if row.hasNull(atIndex: 1) { return nil } else { - return try! SerializedInfo(serializedData: row[1]) + return try! SerializedInfo(serializedBytes: row[1]) } }() } @@ -426,12 +426,12 @@ public extension DbUser { public var gen0: SerializedInfo public var gen1: SerializedInfo? public init(row: Row) { - gen0 = try! SerializedInfo(serializedData: row[0]) + gen0 = try! SerializedInfo(serializedBytes: row[0]) gen1 = { if row.hasNull(atIndex: 1) { return nil } else { - return try! SerializedInfo(serializedData: row[1]) + return try! SerializedInfo(serializedBytes: row[1]) } }() } diff --git a/Parser/src/dynamic_queries/return_type.rs b/Parser/src/dynamic_queries/return_type.rs index 15e482b..8a4bb7c 100644 --- a/Parser/src/dynamic_queries/return_type.rs +++ b/Parser/src/dynamic_queries/return_type.rs @@ -142,7 +142,7 @@ impl<'a> ReturnType<'a> { { let row_index = create_row_index(&decoder.row_index()); let decode = format!( - "try! {}(serializedData: {})", + "try! {}(serializedBytes: {})", swift_property.swift_type.type_name, row_index ); let decode = wrap_null_check( diff --git a/Parser/src/format_swift_code.rs b/Parser/src/format_swift_code.rs index f06cac8..eb75881 100644 --- a/Parser/src/format_swift_code.rs +++ b/Parser/src/format_swift_code.rs @@ -10,7 +10,7 @@ pub fn format_swift_code(config: &Config, safe_output_dir: &Path) { let output = Command::new("swiftformat") .current_dir(safe_output_dir) // TODO Not sure how the --swiftversion flag works, can't get it to work - .args(&["."]) + .args(["."]) .output() .unwrap_or_else(|_| panic!("Problem formatting code in: {:#?}", safe_output_dir)); @@ -29,7 +29,7 @@ pub fn format_swift_code(config: &Config, safe_output_dir: &Path) { let output = Command::new("swiftlint") .current_dir(safe_output_dir) - .args(&["--fix"]) + .args(["--fix"]) .output() .unwrap(); diff --git a/Parser/src/main.rs b/Parser/src/main.rs index cab5261..3a2c48b 100644 --- a/Parser/src/main.rs +++ b/Parser/src/main.rs @@ -107,12 +107,12 @@ fn main() { .collect::>() .join("\n"); let config = Config { - visibility: Visibility::from_str(&*properties::VISIBILITY), + visibility: Visibility::from_str(&properties::VISIBILITY), output_dir: Path::new(&*properties::OUTPUT_DIR).to_owned(), custom_mapping, dynamic_queries, - suffix_swift_structs: &*properties::SUFFIX_SWIFT_STRUCTS, - prefix_swift_structs: &*properties::PREFIX_SWIFT_STRUCTS, + suffix_swift_structs: &properties::SUFFIX_SWIFT_STRUCTS, + prefix_swift_structs: &properties::PREFIX_SWIFT_STRUCTS, use_swiftformat: *properties::USE_SWIFTFORMAT, use_swiftlint: *properties::USE_SWIFTLINT, sqlite_location: properties::SQLITE_LOCATION.to_owned(), diff --git a/Parser/src/swift_property.rs b/Parser/src/swift_property.rs index 9ac3832..6c76288 100644 --- a/Parser/src/swift_property.rs +++ b/Parser/src/swift_property.rs @@ -74,7 +74,7 @@ impl SwiftProperty { prefix, self.swift_property_name, serialize_question_mark, ); let deserialize = format!( - "{}try! {}(serializedData: {})", + "{}try! {}(serializedBytes: {})", deserialize_return_if_nil, self.swift_type.type_name.replace('?', ""), self.swift_property_name diff --git a/new_version/src/main.rs b/new_version/src/main.rs index 86ad657..56b9283 100644 --- a/new_version/src/main.rs +++ b/new_version/src/main.rs @@ -43,7 +43,7 @@ fn main() { // Run the swift tests assert!(Command::new("xcodebuild") - .args(&[ + .args([ "test", "-project", "GRDBPerformance.xcodeproj",