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:
@ -645,19 +645,19 @@ pub fn (err HeaderKeyError) code() int {
|
||||
fn is_valid(header string) ! {
|
||||
for _, c in header {
|
||||
if int(c) >= 128 || !is_token(c) {
|
||||
return IError(HeaderKeyError{
|
||||
return HeaderKeyError{
|
||||
code: 1
|
||||
header: header
|
||||
invalid_char: c
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if header.len == 0 {
|
||||
return IError(HeaderKeyError{
|
||||
return HeaderKeyError{
|
||||
code: 2
|
||||
header: header
|
||||
invalid_char: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ pub fn (mut s SSLConn) socket_read_into_ptr(buf_ptr &u8, len int) !int {
|
||||
if res > 0 {
|
||||
return res
|
||||
} else if res == 0 {
|
||||
return IError(io.Eof{})
|
||||
return io.Eof{}
|
||||
} else {
|
||||
match res {
|
||||
C.MBEDTLS_ERR_SSL_WANT_READ {
|
||||
|
@ -274,7 +274,7 @@ pub fn (mut s SSLConn) socket_read_into_ptr(buf_ptr &u8, len int) !int {
|
||||
if res > 0 {
|
||||
return res
|
||||
} else if res == 0 {
|
||||
return IError(io.Eof{})
|
||||
return io.Eof{}
|
||||
} else {
|
||||
err_res := ssl_error(res, s.ssl)!
|
||||
match err_res {
|
||||
|
@ -135,10 +135,10 @@ pub fn (c TcpConn) read_ptr(buf_ptr &u8, len int) !int {
|
||||
|
||||
pub fn (c TcpConn) read(mut buf []u8) !int {
|
||||
return c.read_ptr(buf.data, buf.len) or {
|
||||
return IError(io.NotExpected{
|
||||
return io.NotExpected{
|
||||
cause: 'unexpected error in `read_ptr` function'
|
||||
code: -1
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user