1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: smarter if condition wrapping (#8201)

This commit is contained in:
Lukas Neubert
2021-01-23 09:33:22 +01:00
committed by GitHub
parent 9812230847
commit 8b61891348
65 changed files with 686 additions and 811 deletions

View File

@@ -396,7 +396,7 @@ pub fn is_file(path string) bool {
// is_abs_path returns `true` if `path` is absolute.
pub fn is_abs_path(path string) bool {
$if windows {
return path[0] == `/` || // incase we're in MingGW bash
return path[0] == `/` || // incase we're in MingGW bash
(path[0].is_letter() && path[1] == `:`)
}
return path[0] == `/`

View File

@@ -771,9 +771,8 @@ fn normalize_drive_letter(path string) string {
$if !windows {
return path
}
if path.len > 2 &&
path[0] >= `a` && path[0] <= `z` && path[1] == `:` && path[2] == path_separator[0]
{
if path.len > 2 && path[0] >= `a` && path[0] <= `z` && path[1] == `:`
&& path[2] == path_separator[0] {
unsafe {
x := &path.str[0]
(*x) = *x - 32

View File

@@ -92,10 +92,8 @@ pub fn ls(path string) ?[]string {
}
bptr := byteptr(ent.d_name)
unsafe {
if bptr[0] == 0 ||
(bptr[0] == `.` && bptr[1] == 0) ||
(bptr[0] == `.` && bptr[1] == `.` && bptr[2] == 0)
{
if bptr[0] == 0 || (bptr[0] == `.` && bptr[1] == 0)
|| (bptr[0] == `.` && bptr[1] == `.` && bptr[2] == 0) {
continue
}
}

View File

@@ -135,7 +135,8 @@ pub fn mkdir(path string) ?bool {
}
apath := real_path(path)
if !C.CreateDirectory(apath.to_wide(), 0) {
return error('mkdir failed for "$apath", because CreateDirectory returned ' + get_error_msg(int(C.GetLastError())))
return error('mkdir failed for "$apath", because CreateDirectory returned ' +
get_error_msg(int(C.GetLastError())))
}
return true
}