Skip to content

Commit

Permalink
Merge pull request #233 from keiravillekode/notice-warning
Browse files Browse the repository at this point in the history
Address compiler warnings/notices
  • Loading branch information
kahgoh authored Oct 7, 2024
2 parents d8347c2 + 50d9081 commit 757a23f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion exercises/practice/allergies/run_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fn test_list_everything() {
Allergen.strawberries, Allergen.tomatoes, Allergen.chocolate, Allergen.pollen, Allergen.cats])
}

fn compare(left voidptr, right voidptr) int {
fn compare(left &Allergen, right &Allergen) int {
return int(left) - int(right)
}

Expand Down
3 changes: 1 addition & 2 deletions exercises/practice/custom-set/.meta/example.v
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mut:
items map[T]u8
}

[inline]
@[inline]
fn (s CustomSet[T]) items() []T {
return s.items.keys()
}
Expand Down Expand Up @@ -74,4 +74,3 @@ pub fn (s CustomSet[T]) is_subset[T](other CustomSet[T]) bool {
pub fn (s CustomSet[T]) is_disjoint[T](other CustomSet[T]) bool {
return s.intersection(other).is_empty()
}

8 changes: 3 additions & 5 deletions exercises/practice/custom-set/run_test.v
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module main

const (
empty = CustomSet.new([]int{})
another_empty = CustomSet.new([]int{})
non_empty = CustomSet.new([1])
)
const empty = CustomSet.new([]int{})
const another_empty = CustomSet.new([]int{})
const non_empty = CustomSet.new([1])

// is_empty

Expand Down
13 changes: 6 additions & 7 deletions exercises/practice/isbn-verifier/.meta/example.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module main
import arrays { group, sum }
import regex { regex_opt }

const (
isbn_len = 10
const isbn_len = 10

/*
/*
Using a regular expression, I now have two problems:
https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/
Expand All @@ -15,10 +14,10 @@ const (
- length check
- character validation
*/
isbn_re = regex_opt(r'^\d{9}(\d|X)$') or { panic('Invalid ISBN-10 regular expression') }
weights = []int{len: isbn_len, init: isbn_len - index} // [10, 9, 8, ..., 1]
zero = int(`0`)
)
const isbn_re = regex_opt(r'^\d{9}(\d|X)$') or { panic('Invalid ISBN-10 regular expression') }
const weights = []int{len: isbn_len, init: isbn_len - index} // [10, 9, 8, ..., 1]

const zero = int(`0`)

// convert single digit (`0`...`9`) to its integer equivalent.
fn digit_to_int(d u8) int {
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/yacht/.meta/example.v
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn score(category Category, rolls []u8) int {

fn score_yacht(rolls []u8) int {
unique := arrays.uniq(rolls)
if (unique.len > 1) {
if unique.len > 1 {
return 0
}
return 50
Expand Down

0 comments on commit 757a23f

Please sign in to comment.