diff options
author | Mamy Ratsimbazafy <mamy_github@numforge.co> | 2020-08-24 08:05:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-24 08:05:17 +0200 |
commit | 07d82b5cc4b7ba177de43a3eb46c7c645930421a (patch) | |
tree | 5b4dbd2a4dc883426422b3b28753314770f03d45 /lib | |
parent | 575697e1f4d94cfe080edb28f88ce8982b8add54 (diff) | |
download | Nim-07d82b5cc4b7ba177de43a3eb46c7c645930421a.tar.gz |
Use more `lent` in options (#15208)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/options.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/options.nim b/lib/pure/options.nim index d56cf4767..4efe04d67 100644 --- a/lib/pure/options.nim +++ b/lib/pure/options.nim @@ -363,14 +363,14 @@ proc `$`*[T](self: Option[T]): string = else: result = "None[" & name(T) & "]" -proc unsafeGet*[T](self: Option[T]): T {.inline.}= +proc unsafeGet*[T](self: Option[T]): lent T {.inline.}= ## Returns the value of a `some`. Behavior is undefined for `none`. ## ## **Note:** Use it only when you are **absolutely sure** the value is present ## (e.g. after checking `isSome <#isSome,Option[T]>`_). ## Generally, using `get proc <#get,Option[T]>`_ is preferred. assert self.isSome - self.val + result = self.val when isMainModule: |