find/fix more fmt errors

This commit is contained in:
Emil Lerch 2023-08-05 13:29:23 -07:00
parent c18de40edd
commit 63ff325068
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
2 changed files with 12 additions and 12 deletions

View File

@ -358,7 +358,7 @@ fn createCanonicalRequest(allocator: std.mem.Allocator, request: base.Request, p
; ;
// TODO: This is all better as a writer - less allocations/copying // TODO: This is all better as a writer - less allocations/copying
const canonical_method = canonicalRequestMethod(request.method); const canonical_method = try canonicalRequestMethod(request.method);
// Let's not mess around here...s3 is the oddball // Let's not mess around here...s3 is the oddball
const double_encode = !std.mem.eql(u8, config.service, "s3"); const double_encode = !std.mem.eql(u8, config.service, "s3");
const canonical_url = try canonicalUri(allocator, request.path, double_encode); const canonical_url = try canonicalUri(allocator, request.path, double_encode);

View File

@ -102,7 +102,7 @@ fn parseInternal(comptime T: type, element: *xml.Element, options: ParseOptions)
return std.fmt.parseFloat(T, element.children.items[0].CharData) catch |e| { return std.fmt.parseFloat(T, element.children.items[0].CharData) catch |e| {
if (log_parse_traces) { if (log_parse_traces) {
std.log.err( std.log.err(
"Could not parse '{s}' as float in element '{s}': {s}", "Could not parse '{s}' as float in element '{s}': {any}",
.{ .{
element.children.items[0].CharData, element.children.items[0].CharData,
element.tag, element.tag,
@ -127,7 +127,7 @@ fn parseInternal(comptime T: type, element: *xml.Element, options: ParseOptions)
} }
if (log_parse_traces) { if (log_parse_traces) {
std.log.err( std.log.err(
"Could not parse '{s}' as integer in element '{s}': {s}", "Could not parse '{s}' as integer in element '{s}': {any}",
.{ .{
element.children.items[0].CharData, element.children.items[0].CharData,
element.tag, element.tag,
@ -392,7 +392,7 @@ test "can parse a simple type" {
foo_bar: []const u8, foo_bar: []const u8,
}; };
// std.debug.print("{s}", .{data}); // std.debug.print("{s}", .{data});
const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }); const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual });
defer parsed_data.deinit(); defer parsed_data.deinit();
try testing.expectEqualStrings("bar", parsed_data.parsed_value.foo_bar); try testing.expectEqualStrings("bar", parsed_data.parsed_value.foo_bar);
} }
@ -410,7 +410,7 @@ test "can parse a boolean type" {
foo_bar: bool, foo_bar: bool,
}; };
// std.debug.print("{s}", .{data}); // std.debug.print("{s}", .{data});
const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }); const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual });
defer parsed_data.deinit(); defer parsed_data.deinit();
try testing.expectEqual(true, parsed_data.parsed_value.foo_bar); try testing.expectEqual(true, parsed_data.parsed_value.foo_bar);
} }
@ -427,7 +427,7 @@ test "can parse an integer type" {
foo_bar: u8, foo_bar: u8,
}; };
// std.debug.print("{s}", .{data}); // std.debug.print("{s}", .{data});
const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }); const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual });
defer parsed_data.deinit(); defer parsed_data.deinit();
try testing.expectEqual(@as(u8, 42), parsed_data.parsed_value.foo_bar); try testing.expectEqual(@as(u8, 42), parsed_data.parsed_value.foo_bar);
} }
@ -442,7 +442,7 @@ test "can parse an optional boolean type" {
const ExampleDoesNotMatter = struct { const ExampleDoesNotMatter = struct {
foo_bar: ?bool = null, foo_bar: ?bool = null,
}; };
const parsed_data = try parse(ExampleDoesNotMatter, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }); const parsed_data = try parse(ExampleDoesNotMatter, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual });
defer parsed_data.deinit(); defer parsed_data.deinit();
try testing.expectEqual(@as(?bool, true), parsed_data.parsed_value.foo_bar); try testing.expectEqual(@as(?bool, true), parsed_data.parsed_value.foo_bar);
} }
@ -458,7 +458,7 @@ test "can coerce 8601 date to integer" {
const ExampleDoesNotMatter = struct { const ExampleDoesNotMatter = struct {
foo_bar: ?i64 = null, foo_bar: ?i64 = null,
}; };
const parsed_data = try parse(ExampleDoesNotMatter, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }); const parsed_data = try parse(ExampleDoesNotMatter, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual });
defer parsed_data.deinit(); defer parsed_data.deinit();
try testing.expectEqual(@as(i64, 1633451985), parsed_data.parsed_value.foo_bar.?); try testing.expectEqual(@as(i64, 1633451985), parsed_data.parsed_value.foo_bar.?);
} }
@ -477,7 +477,7 @@ test "can parse a boolean type (two fields)" {
foo_bar: bool, foo_bar: bool,
foo_baz: bool, foo_baz: bool,
}; };
const parsed_data = try parse(ExampleDoesNotMatter, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }); const parsed_data = try parse(ExampleDoesNotMatter, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual });
defer parsed_data.deinit(); defer parsed_data.deinit();
try testing.expectEqual(@as(bool, true), parsed_data.parsed_value.foo_bar); try testing.expectEqual(@as(bool, true), parsed_data.parsed_value.foo_bar);
} }
@ -499,7 +499,7 @@ test "can error without leaking memory" {
defer log_parse_traces = true; defer log_parse_traces = true;
try std.testing.expectError( try std.testing.expectError(
error.InvalidCharacter, error.InvalidCharacter,
parse(ExampleDoesNotMatter, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }), parse(ExampleDoesNotMatter, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual }),
); );
} }
@ -518,7 +518,7 @@ test "can parse a nested type" {
bar: []const u8, bar: []const u8,
}, },
}; };
const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }); const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual });
defer parsed_data.deinit(); defer parsed_data.deinit();
try testing.expectEqualStrings("baz", parsed_data.parsed_value.foo.bar); try testing.expectEqualStrings("baz", parsed_data.parsed_value.foo.bar);
} }
@ -539,7 +539,7 @@ test "can parse a nested type - two fields" {
qux: []const u8, qux: []const u8,
}, },
}; };
const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate = fuzzyEqual }); const parsed_data = try parse(Example, data, .{ .allocator = allocator, .match_predicate_ptr = fuzzyEqual });
defer parsed_data.deinit(); defer parsed_data.deinit();
try testing.expectEqualStrings("baz", parsed_data.parsed_value.foo.bar); try testing.expectEqualStrings("baz", parsed_data.parsed_value.foo.bar);
try testing.expectEqualStrings("baz", parsed_data.parsed_value.foo.qux); try testing.expectEqualStrings("baz", parsed_data.parsed_value.foo.qux);