From ea31f750986e5af070c7e58bdff43b33463c1537 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 9 Sep 2020 14:14:44 +0200 Subject: [PATCH] checker: more default field fixes --- vlib/io/util/util.v | 4 ++-- vlib/net/html/data_structures.v | 4 ++-- vlib/net/html/parser.v | 6 +++--- vlib/net/html/tag.v | 2 +- vlib/rand/mt19937/mt19937.v | 8 ++++---- vlib/regex/regex.v | 8 ++++---- vlib/regex/regex_test.v | 10 +++++----- vlib/sync/atomic2/atomic_test.v | 2 +- vlib/v/util/vtest/vtest.v | 2 +- vlib/vweb/tests/vweb_test.v | 4 ++-- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/vlib/io/util/util.v b/vlib/io/util/util.v index 8d4031119d..44eaedf26b 100644 --- a/vlib/io/util/util.v +++ b/vlib/io/util/util.v @@ -11,7 +11,7 @@ const ( pub struct TempFileOptions { path string = os.temp_dir() - pattern string = '' + pattern string } // temp_file returns an uniquely named, open, writable, `os.File` and it's path @@ -49,7 +49,7 @@ pub fn temp_file(tfo TempFileOptions) ?(os.File, string) { pub struct TempDirOptions { path string = os.temp_dir() - pattern string = '' + pattern string } // temp_dir returns an uniquely named, writable, directory path diff --git a/vlib/net/html/data_structures.v b/vlib/net/html/data_structures.v index 45b6022e49..734920bac7 100644 --- a/vlib/net/html/data_structures.v +++ b/vlib/net/html/data_structures.v @@ -5,7 +5,7 @@ struct Stack { null_element int = C.INT_MIN mut: elements []int - size int = 0 + size int } fn (stack Stack) is_null(data int) bool { @@ -44,7 +44,7 @@ fn (mut stack Stack) push(item int) { struct BTree { mut: all_tags []Tag - node_pointer int = 0 + node_pointer int childrens [][]int parents []int } diff --git a/vlib/net/html/parser.v b/vlib/net/html/parser.v index ec9080335f..8041ae13d8 100644 --- a/vlib/net/html/parser.v +++ b/vlib/net/html/parser.v @@ -7,11 +7,11 @@ mut: current_tag &Tag open_tag bool = false open_code bool = false - open_string int = 0 + open_string int open_comment bool = false is_attribute bool = false - opened_code_type string = '' - line_count int = 0 + opened_code_type string + line_count int lexeme_builder string code_tags map[string]bool = { 'script': true diff --git a/vlib/net/html/tag.v b/vlib/net/html/tag.v index 85d12afd49..485b5fee79 100644 --- a/vlib/net/html/tag.v +++ b/vlib/net/html/tag.v @@ -15,7 +15,7 @@ mut: attributes map[string]string // attributes will be like map[name]value last_attribute string parent &Tag = C.NULL - position_in_parent int = 0 + position_in_parent int closed bool = false close_type CloseTagType = .in_name } diff --git a/vlib/rand/mt19937/mt19937.v b/vlib/rand/mt19937/mt19937.v index 5139fb31b3..2c8bea0708 100644 --- a/vlib/rand/mt19937/mt19937.v +++ b/vlib/rand/mt19937/mt19937.v @@ -13,7 +13,7 @@ C++ functions for MT19937, with initialization improved 2002/2/10. Matthe Bellew's simplification, Isaku Wada's real version. Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -26,8 +26,8 @@ C++ functions for MT19937, with initialization improved 2002/2/10. notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -61,7 +61,7 @@ pub struct MT19937RNG { mut: state []u64 = calculate_state(util.time_seed_array(2), mut []u64{len: nn}) mti int = nn - next_rnd u32 = 0 + next_rnd u32 has_next bool = false } diff --git a/vlib/regex/regex.v b/vlib/regex/regex.v index 5a68cc5fae..1b1210cedc 100644 --- a/vlib/regex/regex.v +++ b/vlib/regex/regex.v @@ -302,7 +302,7 @@ pub mut: // char classes storage cc []CharClass // char class list - cc_index int = 0 // index + cc_index int // index // state index state_stack_index int= -1 @@ -310,7 +310,7 @@ pub mut: // groups - group_count int = 0 // number of groups in this regex struct + group_count int // number of groups in this regex struct groups []int // groups index results group_max_nested int = 3 // max nested group group_max int = 8 // max allowed number of different groups @@ -321,10 +321,10 @@ pub mut: group_map map[string]int // groups names map // flags - flag int = 0 // flag for optional parameters + flag int // flag for optional parameters // Debug/log - debug int = 0 // enable in order to have the unroll of the code 0 = NO_DEBUG, 1 = LIGHT 2 = VERBOSE + debug int // enable in order to have the unroll of the code 0 = NO_DEBUG, 1 = LIGHT 2 = VERBOSE log_func FnLog = simple_log // log function, can be customized by the user query string = "" // query string } diff --git a/vlib/regex/regex_test.v b/vlib/regex/regex_test.v index 2286a57c19..e0b93c732c 100644 --- a/vlib/regex/regex_test.v +++ b/vlib/regex/regex_test.v @@ -8,8 +8,8 @@ import regex struct TestItem { src string q string - s int = 0 - e int = 0 + s int + e int } const( @@ -239,7 +239,7 @@ fn test_regex(){ if res.len != to.r.len { println("ERROR: find_all, array of different size.") assert false - continue + continue } for c1,i in res { @@ -268,7 +268,7 @@ fn test_regex(){ println("ERROR: replace.") assert false continue - } + } } // check match and find @@ -282,7 +282,7 @@ fn test_regex(){ eprintln('err: $err') assert false continue - } + } // q_str := re.get_query() // println("Query: $q_str") start,end := re.find(to.src) diff --git a/vlib/sync/atomic2/atomic_test.v b/vlib/sync/atomic2/atomic_test.v index ddd6e964f4..f71ce8da82 100644 --- a/vlib/sync/atomic2/atomic_test.v +++ b/vlib/sync/atomic2/atomic_test.v @@ -7,7 +7,7 @@ const ( struct Counter { mut: - counter u64 = 0 + counter u64 } // without proper syncronization this would fail diff --git a/vlib/v/util/vtest/vtest.v b/vlib/v/util/vtest/vtest.v index 0f55080fc5..948cf411d0 100644 --- a/vlib/v/util/vtest/vtest.v +++ b/vlib/v/util/vtest/vtest.v @@ -3,7 +3,7 @@ module vtest import os pub struct FilterVTestConfig { - basepath string = '' + basepath string fix_slashes bool = true } diff --git a/vlib/vweb/tests/vweb_test.v b/vlib/vweb/tests/vweb_test.v index d791dfc61d..9ef8fd1d75 100644 --- a/vlib/vweb/tests/vweb_test.v +++ b/vlib/vweb/tests/vweb_test.v @@ -230,8 +230,8 @@ struct SimpleTcpClientConfig { host string = 'static.dev' path string = '/' agent string = 'v/net.tcp.v' - headers string = '' - content string = '' + headers string + content string } fn simple_tcp_client(config SimpleTcpClientConfig) ?string {