Skip to content

Commit

Permalink
Merge pull request #1551 from skipkayhil/fix-warnings
Browse files Browse the repository at this point in the history
Fix all 'assigned but unused variable' warnings
  • Loading branch information
eval authored Jun 3, 2024
2 parents b641f39 + 8dd1655 commit 4f679ec
Show file tree
Hide file tree
Showing 23 changed files with 148 additions and 73 deletions.
13 changes: 8 additions & 5 deletions lib/mail/parsers/address_lists_parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
Expand Down Expand Up @@ -32011,10 +32010,10 @@ def self.parse(data)
_trans = if (_slen > 0 &&
_trans_keys[_keys] <= _wide &&
_wide <= _trans_keys[_keys + 1])
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
cs = _trans_targs[_trans]
if _trans_actions[_trans] != 0
case _trans_actions[_trans]
Expand Down Expand Up @@ -33229,6 +33228,10 @@ def self.parse(data)
end
end

if false
testEof
end

if p != eof || cs < 2461
raise Mail::Field::IncompleteParseError.new(Mail::AddressList, data, p)
end
Expand Down
4 changes: 4 additions & 0 deletions lib/mail/parsers/address_lists_parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ module Mail::Parsers
%%write init;
%%write exec;

if false
testEof
end

if p != eof || cs < %%{ write first_final; }%%
raise Mail::Field::IncompleteParseError.new(Mail::AddressList, data, p)
end
Expand Down
27 changes: 15 additions & 12 deletions lib/mail/parsers/content_disposition_parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
Expand Down Expand Up @@ -610,10 +609,10 @@ def self.parse(data)
_trans = if (_slen > 0 &&
_trans_keys[_keys] <= _wide &&
_wide <= _trans_keys[_keys + 1])
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
cs = _trans_targs[_trans]
if _trans_actions[_trans] != 0
case _trans_actions[_trans]
Expand Down Expand Up @@ -654,7 +653,7 @@ def self.parse(data)
# Use quoted string value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_disposition.parameters << {param_attr => value}
content_disposition.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand Down Expand Up @@ -712,7 +711,7 @@ def self.parse(data)
# Use quoted string value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_disposition.parameters << {param_attr => value}
content_disposition.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand Down Expand Up @@ -742,7 +741,7 @@ def self.parse(data)
# Use quoted string value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_disposition.parameters << {param_attr => value}
content_disposition.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand Down Expand Up @@ -799,7 +798,7 @@ def self.parse(data)
# Use quoted string value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_disposition.parameters << {param_attr => value}
content_disposition.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand All @@ -823,7 +822,7 @@ def self.parse(data)
# Use quoted string value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_disposition.parameters << {param_attr => value}
content_disposition.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand Down Expand Up @@ -857,7 +856,7 @@ def self.parse(data)
# Use quoted string value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_disposition.parameters << {param_attr => value}
content_disposition.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand All @@ -875,7 +874,7 @@ def self.parse(data)
# Use quoted string value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_disposition.parameters << {param_attr => value}
content_disposition.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand All @@ -888,6 +887,10 @@ def self.parse(data)
end
end

if false
testEof
end

if p != eof || cs < 40
raise Mail::Field::IncompleteParseError.new(Mail::ContentDispositionElement, data, p)
end
Expand Down
4 changes: 4 additions & 0 deletions lib/mail/parsers/content_disposition_parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ module Mail::Parsers
%%write init;
%%write exec;

if false
testEof
end

if p != eof || cs < %%{ write first_final; }%%
raise Mail::Field::IncompleteParseError.new(Mail::ContentDispositionElement, data, p)
end
Expand Down
15 changes: 9 additions & 6 deletions lib/mail/parsers/content_location_parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
Expand Down Expand Up @@ -589,7 +588,7 @@ def self.parse(data)
return content_location if Mail::Utilities.blank?(data)

# Parser state
disp_type_s = param_attr_s = param_attr = qstr_s = qstr = param_val_s = nil
qstr_s = qstr = param_val_s = nil

# 5.1 Variables Used by Ragel
p = 0
Expand Down Expand Up @@ -631,10 +630,10 @@ def self.parse(data)
_trans = if (_slen > 0 &&
_trans_keys[_keys] <= _wide &&
_wide <= _trans_keys[_keys + 1])
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
cs = _trans_targs[_trans]
if _trans_actions[_trans] != 0
case _trans_actions[_trans]
Expand Down Expand Up @@ -809,6 +808,10 @@ def self.parse(data)
end
end

if false
testEof
end

if p != eof || cs < 32
raise Mail::Field::IncompleteParseError.new(Mail::ContentLocationElement, data, p)
end
Expand Down
6 changes: 5 additions & 1 deletion lib/mail/parsers/content_location_parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module Mail::Parsers
return content_location if Mail::Utilities.blank?(data)

# Parser state
disp_type_s = param_attr_s = param_attr = qstr_s = qstr = param_val_s = nil
qstr_s = qstr = param_val_s = nil

# 5.1 Variables Used by Ragel
p = 0
Expand All @@ -64,6 +64,10 @@ module Mail::Parsers
%%write init;
%%write exec;

if false
testEof
end

if p != eof || cs < %%{ write first_final; }%%
raise Mail::Field::IncompleteParseError.new(Mail::ContentLocationElement, data, p)
end
Expand Down
13 changes: 8 additions & 5 deletions lib/mail/parsers/content_transfer_encoding_parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
Expand Down Expand Up @@ -382,10 +381,10 @@ def self.parse(data)
_trans = if (_slen > 0 &&
_trans_keys[_keys] <= _wide &&
_wide <= _trans_keys[_keys + 1])
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
cs = _trans_targs[_trans]
if _trans_actions[_trans] != 0
case _trans_actions[_trans]
Expand Down Expand Up @@ -509,6 +508,10 @@ def self.parse(data)
end
end

if false
testEof
end

if p != eof || cs < 21
raise Mail::Field::IncompleteParseError.new(Mail::ContentTransferEncodingElement, data, p)
end
Expand Down
4 changes: 4 additions & 0 deletions lib/mail/parsers/content_transfer_encoding_parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ module Mail::Parsers
%%write init;
%%write exec;

if false
testEof
end

if p != eof || cs < %%{ write first_final; }%%
raise Mail::Field::IncompleteParseError.new(Mail::ContentTransferEncodingElement, data, p)
end
Expand Down
27 changes: 15 additions & 12 deletions lib/mail/parsers/content_type_parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
Expand Down Expand Up @@ -736,10 +735,10 @@ def self.parse(data)
_trans = if (_slen > 0 &&
_trans_keys[_keys] <= _wide &&
_wide <= _trans_keys[_keys + 1])
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
cs = _trans_targs[_trans]
if _trans_actions[_trans] != 0
case _trans_actions[_trans]
Expand Down Expand Up @@ -788,7 +787,7 @@ def self.parse(data)
# Use quoted s value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_type.parameters << {param_attr => value}
content_type.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand Down Expand Up @@ -859,7 +858,7 @@ def self.parse(data)
# Use quoted s value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_type.parameters << {param_attr => value}
content_type.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand Down Expand Up @@ -889,7 +888,7 @@ def self.parse(data)
# Use quoted s value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_type.parameters << {param_attr => value}
content_type.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand Down Expand Up @@ -946,7 +945,7 @@ def self.parse(data)
# Use quoted s value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_type.parameters << {param_attr => value}
content_type.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand All @@ -970,7 +969,7 @@ def self.parse(data)
# Use quoted s value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_type.parameters << {param_attr => value}
content_type.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand Down Expand Up @@ -1004,7 +1003,7 @@ def self.parse(data)
# Use quoted s value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_type.parameters << {param_attr => value}
content_type.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand All @@ -1022,7 +1021,7 @@ def self.parse(data)
# Use quoted s value if one exists, otherwise use parameter value
value = qstr || chars(data, param_val_s, p - 1)

content_type.parameters << {param_attr => value}
content_type.parameters << { param_attr => value }
param_attr = nil
qstr = nil
end
Expand All @@ -1035,6 +1034,10 @@ def self.parse(data)
end
end

if false
testEof
end

if p != eof || cs < 47
raise Mail::Field::IncompleteParseError.new(Mail::ContentTypeElement, data, p)
end
Expand Down
4 changes: 4 additions & 0 deletions lib/mail/parsers/content_type_parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ module Mail::Parsers
%%write init;
%%write exec;

if false
testEof
end

if p != eof || cs < %%{ write first_final; }%%
raise Mail::Field::IncompleteParseError.new(Mail::ContentTypeElement, data, p)
end
Expand Down
13 changes: 8 additions & 5 deletions lib/mail/parsers/date_time_parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
Expand Down Expand Up @@ -715,10 +714,10 @@ def self.parse(data)
_trans = if (_slen > 0 &&
_trans_keys[_keys] <= _wide &&
_wide <= _trans_keys[_keys + 1])
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
_indicies[_inds + _wide - _trans_keys[_keys]]
else
_indicies[_inds + _slen]
end
cs = _trans_targs[_trans]
if _trans_actions[_trans] != 0
case _trans_actions[_trans]
Expand Down Expand Up @@ -878,6 +877,10 @@ def self.parse(data)
end
end

if false
testEof
end

if p != eof || cs < 103
raise Mail::Field::IncompleteParseError.new(Mail::DateTimeElement, data, p)
end
Expand Down
4 changes: 4 additions & 0 deletions lib/mail/parsers/date_time_parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ module Mail::Parsers
%%write init;
%%write exec;

if false
testEof
end

if p != eof || cs < %%{ write first_final; }%%
raise Mail::Field::IncompleteParseError.new(Mail::DateTimeElement, data, p)
end
Expand Down
Loading

0 comments on commit 4f679ec

Please sign in to comment.