From 11a8aa64d27d4fa92e266b9488500461da193c24 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Sun, 5 Dec 2021 15:52:47 +0100 Subject: [PATCH] enable --styleCheck:usages --- README.md | 4 ++-- serialization.nim | 6 +++--- serialization.nimble | 2 +- serialization/object_serialization.nim | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f136140..d36fb29 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ serializationFormat Json, # This is the name of the for PreferredOutput = string, # APIs such as `Json.encode` will return this type. # The type must support the following operations: # proc initWithCapacity(_: type T, n: int) - # proc add(v: var T, bytes: openarray[byte]) + # proc add(v: var T, bytes: openArray[byte]) # By default, the PreferredOutput is `seq[byte]`. mimeType = "application/json", # Mime type associated with the format (Optional). @@ -60,7 +60,7 @@ Example: assert Json.encode(@[1, 2, 3], pretty = false) == "[1, 2, 3]" ``` -#### `Format.decode(input: openarray[byte]|string, RecordType: type, params: varargs): RecordType` +#### `Format.decode(input: openArray[byte]|string, RecordType: type, params: varargs): RecordType` Decodes and returns a value of the specified `RecordType`. All params will be forwarded without modification to the used `Reader` type. A Format-specific diff --git a/serialization.nim b/serialization.nim index 2f07dc7..d1fad14 100644 --- a/serialization.nim +++ b/serialization.nim @@ -34,7 +34,7 @@ template decode*(Format: distinct type, RecordType: distinct type, params: varargs[untyped]): auto = # TODO, this is dusplicated only due to a Nim bug: - # If `input` was `string|openarray[byte]`, it won't match `seq[byte]` + # If `input` was `string|openArray[byte]`, it won't match `seq[byte]` mixin init, Reader {.noSideEffect.}: # We assume that there are no side-effects here, because we are @@ -50,11 +50,11 @@ template decode*(Format: distinct type, raise (ref Defect)() # memory inputs cannot raise an IOError template decode*(Format: distinct type, - input: openarray[byte], + input: openArray[byte], RecordType: distinct type, params: varargs[untyped]): auto = # TODO, this is dusplicated only due to a Nim bug: - # If `input` was `string|openarray[byte]`, it won't match `seq[byte]` + # If `input` was `string|openArray[byte]`, it won't match `seq[byte]` mixin init, Reader {.noSideEffect.}: # We assume that there are no side-effects here, because we are diff --git a/serialization.nimble b/serialization.nimble index 9d6ff04..dde60cb 100644 --- a/serialization.nimble +++ b/serialization.nimble @@ -13,6 +13,6 @@ requires "nim >= 1.2.0", "stew" task test, "Run all tests": - let common_args = "c -r -f --hints:off --skipParentCfg" + let common_args = "c -r -f --hints:off --skipParentCfg --styleCheck:usages --styleCheck:error" exec "nim " & common_args & " --threads:off tests/test_all" exec "nim " & common_args & " --threads:on tests/test_all" diff --git a/serialization/object_serialization.nim b/serialization/object_serialization.nim index a716084..26ce0aa 100644 --- a/serialization/object_serialization.nim +++ b/serialization/object_serialization.nim @@ -167,7 +167,7 @@ type {.gcsafe, nimcall, raises: [SerializationError, Defect].} ] - FieldReadersTable*[RecordType, Reader] = openarray[FieldReader[RecordType, Reader]] + FieldReadersTable*[RecordType, Reader] = openArray[FieldReader[RecordType, Reader]] proc totalSerializedFieldsImpl(T: type): int = mixin enumAllSerializedFields