hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 59ee4d834e0661599af4abced30727f27ee458ce
parent d2bfe1140f3ea9c3ec454060a5aaedcc3d715b85
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 12 Feb 2021 10:27:05 -0500

all: return without explicit void where appropriate

Diffstat:
Mbytes/tokenize.ha | 2+-
Mencoding/utf8/decode.ha | 2+-
Mos/+linux/fdstream.ha | 2+-
Mos/exec/cmd.ha | 2+-
Mstrconv/stou.ha | 2--
5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/bytes/tokenize.ha b/bytes/tokenize.ha @@ -13,7 +13,7 @@ export fn tokenize(s: []u8, delim: []u8) tokenizer = tokenizer { // beginning or end of the sequence, respectively. export fn next_token(s: *tokenizer) ([]u8 | void) = { if (len(s.s) == 0) { - return void; + return; }; match (index(s.s, s.d)) { diff --git a/encoding/utf8/decode.ha b/encoding/utf8/decode.ha @@ -26,7 +26,7 @@ export type invalid = void; // returned. And if an invalid sequence is encountered, invalid returned. export fn next(d: *decoder) (rune | void | more | invalid) = { if (d.offs >= len(d.src)) { - return void; + return; }; // XXX: It would be faster if we decoded and measured at the same time. diff --git a/os/+linux/fdstream.ha b/os/+linux/fdstream.ha @@ -49,7 +49,7 @@ fn is_fdstream(s: *io::stream) bool = { // associated with this stream, void is returned. export fn streamfd(s: *io::stream) (int | void) = { if (!is_fdstream(s)) { - return void; + return; }; let stream = s: *fd_stream; return stream.fd; diff --git a/os/exec/cmd.ha b/os/exec/cmd.ha @@ -82,7 +82,7 @@ export fn start(cmd: *command) (error | void) = { fn lookup(name: str) (platform | void) = { const path = match (os::getenv("PATH")) { - void => return void, + void => return, s: str => s, }; let tok = strings::tokenize(path, ":"); diff --git a/strconv/stou.ha b/strconv/stou.ha @@ -10,8 +10,6 @@ fn rune_to_integer(r: rune) (u64 | void) = { return (r: u32 - 'a': u32): u64 + 10 else if (ascii::isalpha(r) && ascii::isupper(r)) return (r: u32 - 'A': u32): u64 + 10; - - return void; }; // Converts a string to a u64 in the given base, If the string contains any