enable --styleCheck:usages

This commit is contained in:
Jacek Sieka 2021-12-05 15:52:47 +01:00 committed by zah
parent fcd0eadadd
commit 11a8aa64d2
4 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ serializationFormat Json, # This is the name of the for
PreferredOutput = string, # APIs such as `Json.encode` will return this type. PreferredOutput = string, # APIs such as `Json.encode` will return this type.
# The type must support the following operations: # The type must support the following operations:
# proc initWithCapacity(_: type T, n: int) # 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]`. # By default, the PreferredOutput is `seq[byte]`.
mimeType = "application/json", # Mime type associated with the format (Optional). 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]" 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 Decodes and returns a value of the specified `RecordType`. All params will
be forwarded without modification to the used `Reader` type. A Format-specific be forwarded without modification to the used `Reader` type. A Format-specific

View File

@ -34,7 +34,7 @@ template decode*(Format: distinct type,
RecordType: distinct type, RecordType: distinct type,
params: varargs[untyped]): auto = params: varargs[untyped]): auto =
# TODO, this is dusplicated only due to a Nim bug: # 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 mixin init, Reader
{.noSideEffect.}: {.noSideEffect.}:
# We assume that there are no side-effects here, because we are # 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 raise (ref Defect)() # memory inputs cannot raise an IOError
template decode*(Format: distinct type, template decode*(Format: distinct type,
input: openarray[byte], input: openArray[byte],
RecordType: distinct type, RecordType: distinct type,
params: varargs[untyped]): auto = params: varargs[untyped]): auto =
# TODO, this is dusplicated only due to a Nim bug: # 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 mixin init, Reader
{.noSideEffect.}: {.noSideEffect.}:
# We assume that there are no side-effects here, because we are # We assume that there are no side-effects here, because we are

View File

@ -13,6 +13,6 @@ requires "nim >= 1.2.0",
"stew" "stew"
task test, "Run all tests": 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:off tests/test_all"
exec "nim " & common_args & " --threads:on tests/test_all" exec "nim " & common_args & " --threads:on tests/test_all"

View File

@ -167,7 +167,7 @@ type
{.gcsafe, nimcall, raises: [SerializationError, Defect].} {.gcsafe, nimcall, raises: [SerializationError, Defect].}
] ]
FieldReadersTable*[RecordType, Reader] = openarray[FieldReader[RecordType, Reader]] FieldReadersTable*[RecordType, Reader] = openArray[FieldReader[RecordType, Reader]]
proc totalSerializedFieldsImpl(T: type): int = proc totalSerializedFieldsImpl(T: type): int =
mixin enumAllSerializedFields mixin enumAllSerializedFields