From d7e5728e831f2bc9424227c84be477c554c97aa8 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Wed, 8 Apr 2026 13:26:33 +0200 Subject: Switch from pyright to ty Co-Authored-By: Claude Sonnet 4.6 --- src/json/json.c | 2 +- src/json/test_json.c | 2 +- src/std/test_vec.c | 6 ++++-- src/std/time.c | 11 ++++------- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/json/json.c b/src/json/json.c index d16415b..b25839f 100644 --- a/src/json/json.c +++ b/src/json/json.c @@ -9,9 +9,9 @@ #include #include "../std/assert.h" -#include "json.h" #include "../std/str.h" #include "../std/types.h" +#include "json.h" JSONObject *JSONObject_new(Arena *a) { JSONObject *object = new(a, JSONObject, 1); diff --git a/src/json/test_json.c b/src/json/test_json.c index 058f191..b1df94b 100644 --- a/src/json/test_json.c +++ b/src/json/test_json.c @@ -1,5 +1,5 @@ -#include "json.h" #include "../std/testing.h" +#include "json.h" #define JSON_parse_raw(a, s) JSON_parse(a, s, lengthof(s)); diff --git a/src/std/test_vec.c b/src/std/test_vec.c index e95a1b6..451b965 100644 --- a/src/std/test_vec.c +++ b/src/std/test_vec.c @@ -34,7 +34,8 @@ i32 test_vec_push() { Vec v = Vec_new(&perm, i32, 4); i32 vals[] = {10, 20, 30}; - for (i32 i = 0; i < 3; i++) Vec_push(&perm, &v, &vals[i]); + for (i32 i = 0; i < 3; i++) + Vec_push(&perm, &v, &vals[i]); t_assert_equal(v.len, 3); t_assert_equal(*Vec_get(v, i32, 0), 10); @@ -49,7 +50,8 @@ i32 test_vec_grow() { Arena perm = Arena_new(128e3); Vec v = Vec_new(&perm, i32, 2); - for (i32 i = 0; i < 8; i++) Vec_push(&perm, &v, &i); + for (i32 i = 0; i < 8; i++) + Vec_push(&perm, &v, &i); t_assert_equal(v.len, 8); t_assert_equal(Arena_get_used(perm), sizeof(i32) * (2 + 4 + 8)); diff --git a/src/std/time.c b/src/std/time.c index 331f1d5..7a14f06 100644 --- a/src/std/time.c +++ b/src/std/time.c @@ -6,13 +6,12 @@ Time Time_get() { struct timespec system_time; - assert(clock_gettime(CLOCK_MONOTONIC, &system_time) == 0, "clock_gettime failed"); + assert(clock_gettime(CLOCK_MONOTONIC, &system_time) == 0, + "clock_gettime failed"); return (Time){system_time.tv_sec, system_time.tv_nsec}; } -f32 Time_ms(Time time) { - return time.s * 1e3 + time.ns / 1e6; -} +f32 Time_ms(Time time) { return time.s * 1e3 + time.ns / 1e6; } Duration Time_diff(Time end, Time start) { Duration d; @@ -25,9 +24,7 @@ Duration Time_diff(Time end, Time start) { return d; } -f32 Duration_ms(Duration d) { - return d.s * 1e3 + d.ns / 1e6; -} +f32 Duration_ms(Duration d) { return d.s * 1e3 + d.ns / 1e6; } Duration Duration_from_ms(f32 ms) { Duration d; -- cgit v1.3