enable --styleCheck:usages
This commit is contained in:
parent
fcd0eadadd
commit
11a8aa64d2
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue