mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
encoding.csv: remove unnecessary IError() cast
This commit is contained in:
parent
c9934672c4
commit
098db89b85
@ -91,7 +91,7 @@ pub fn (mut r Reader) read() ![]string {
|
||||
fn (mut r Reader) read_line() !string {
|
||||
// last record
|
||||
if r.row_pos == r.data.len {
|
||||
return IError(&EndOfFileError{})
|
||||
return &EndOfFileError{}
|
||||
}
|
||||
le := if r.is_mac_pre_osx_le { '\r' } else { '\n' }
|
||||
mut i := r.data.index_after(le, r.row_pos)
|
||||
@ -103,7 +103,7 @@ fn (mut r Reader) read_line() !string {
|
||||
r.is_mac_pre_osx_le = true
|
||||
} else {
|
||||
// no valid line endings found
|
||||
return IError(&InvalidLineEndingError{})
|
||||
return &InvalidLineEndingError{}
|
||||
}
|
||||
} else {
|
||||
// No line ending on file
|
||||
@ -121,10 +121,10 @@ fn (mut r Reader) read_line() !string {
|
||||
|
||||
fn (mut r Reader) read_record() ![]string {
|
||||
if r.delimiter == r.comment {
|
||||
return IError(&CommentIsDelimiterError{})
|
||||
return &CommentIsDelimiterError{}
|
||||
}
|
||||
if !valid_delim(r.delimiter) {
|
||||
return IError(&InvalidDelimiterError{})
|
||||
return &InvalidDelimiterError{}
|
||||
}
|
||||
mut need_read := true
|
||||
mut keep_raw := false
|
||||
@ -204,7 +204,7 @@ fn (mut r Reader) read_record() ![]string {
|
||||
}
|
||||
}
|
||||
if i <= -1 && fields.len == 0 {
|
||||
return IError(&InvalidDelimiterError{})
|
||||
return &InvalidDelimiterError{}
|
||||
}
|
||||
}
|
||||
return fields
|
||||
|
@ -10,7 +10,7 @@ mut:
|
||||
|
||||
fn (mut s StringReader) read(mut buf []u8) !int {
|
||||
if s.place >= s.text.len {
|
||||
return IError(io.Eof{})
|
||||
return io.Eof{}
|
||||
}
|
||||
max_bytes := 100
|
||||
end := if s.place + max_bytes >= s.text.len { s.text.len } else { s.place + max_bytes }
|
||||
|
Loading…
Reference in New Issue
Block a user