mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: remove unnecessary IError() casts
This commit is contained in:
@@ -87,16 +87,16 @@ fn parse_range(input string) ?Range {
|
||||
fn parse_comparator_set(input string) ?ComparatorSet {
|
||||
raw_comparators := input.split(semver.comparator_sep)
|
||||
if raw_comparators.len > 2 {
|
||||
return IError(&InvalidComparatorFormatError{
|
||||
return &InvalidComparatorFormatError{
|
||||
msg: 'Invalid format of comparator set for input "$input"'
|
||||
})
|
||||
}
|
||||
}
|
||||
mut comparators := []Comparator{}
|
||||
for raw_comp in raw_comparators {
|
||||
c := parse_comparator(raw_comp) or {
|
||||
return IError(&InvalidComparatorFormatError{
|
||||
return &InvalidComparatorFormatError{
|
||||
msg: 'Invalid comparator "$raw_comp" in input "$input"'
|
||||
})
|
||||
}
|
||||
}
|
||||
comparators << c
|
||||
}
|
||||
|
@@ -40,14 +40,12 @@ pub fn (err InvalidVersionFormatError) msg() string {
|
||||
// from returns a `Version` structure parsed from `input` `string`.
|
||||
pub fn from(input string) ?Version {
|
||||
if input.len == 0 {
|
||||
return IError(&EmptyInputError{})
|
||||
return &EmptyInputError{}
|
||||
}
|
||||
raw_version := parse(input)
|
||||
version := raw_version.validate() or {
|
||||
return IError(&InvalidVersionFormatError{
|
||||
input: input
|
||||
})
|
||||
}
|
||||
version := raw_version.validate() or { return &InvalidVersionFormatError{
|
||||
input: input
|
||||
} }
|
||||
return version
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user