From fefb854d4ceb108bcc553619db7e9bfd2e148511 Mon Sep 17 00:00:00 2001 From: Gert Goet Date: Wed, 3 Jan 2024 14:43:45 +0100 Subject: [PATCH] Solve warnings Fixes #1384, #1424, #1572 --- lib/mail/parsers/address_lists_parser.rb | 40 ------ .../parsers/content_disposition_parser.rb | 25 ---- lib/mail/parsers/content_location_parser.rb | 6 +- .../content_transfer_encoding_parser.rb | 1 - lib/mail/parsers/content_type_parser.rb | 25 ---- lib/mail/parsers/date_time_parser.rb | 4 - lib/mail/parsers/envelope_from_parser.rb | 1 - lib/mail/parsers/message_ids_parser.rb | 6 - lib/mail/parsers/mime_version_parser.rb | 1 - lib/mail/parsers/phrase_lists_parser.rb | 1 - lib/mail/parsers/received_parser.rb | 126 ------------------ .../delivery_methods/smtp_connection_spec.rb | 2 - 12 files changed, 1 insertion(+), 237 deletions(-) diff --git a/lib/mail/parsers/address_lists_parser.rb b/lib/mail/parsers/address_lists_parser.rb index f905e7313..793ebcc35 100644 --- a/lib/mail/parsers/address_lists_parser.rb +++ b/lib/mail/parsers/address_lists_parser.rb @@ -31984,7 +31984,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 @@ -32453,9 +32452,6 @@ def self.parse(data) next end end - begin - phrase_e = p - 1 - end when 14 begin if address @@ -32614,9 +32610,6 @@ def self.parse(data) next end end - begin - phrase_e = p - 1 - end when 65 begin group_name_s = p @@ -32650,9 +32643,6 @@ def self.parse(data) next end end - begin - obs_domain_list_s = p - end when 38 begin local_dot_atom_e = p - 1 @@ -32739,12 +32729,6 @@ def self.parse(data) next end end - begin - phrase_e = p - 1 - end - begin - domain_s = p - end when 31 begin begin @@ -32755,12 +32739,6 @@ def self.parse(data) next end end - begin - phrase_e = p - 1 - end - begin - local_dot_atom_pre_comment_e = p - 1 - end when 40 begin if address @@ -32821,9 +32799,6 @@ def self.parse(data) next end end - begin - local_dot_atom_s = p - end when 36 begin local_dot_atom_pre_comment_e = p - 1 @@ -32862,15 +32837,6 @@ def self.parse(data) next end end - begin - address_s = p - end - begin - phrase_s = p - end - begin - local_dot_atom_s = p - end when 64 begin group_name_s = p @@ -32887,12 +32853,6 @@ def self.parse(data) next end end - begin - address_s = p - end - begin - local_dot_atom_s = p - end end end end diff --git a/lib/mail/parsers/content_disposition_parser.rb b/lib/mail/parsers/content_disposition_parser.rb index c92fbda29..e5c7a526b 100644 --- a/lib/mail/parsers/content_disposition_parser.rb +++ b/lib/mail/parsers/content_disposition_parser.rb @@ -583,7 +583,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 @@ -791,18 +790,6 @@ def self.parse(data) next end end - begin - if param_attr.nil? - raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value") - end - - # 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} - param_attr = nil - qstr = nil - end when 21 begin end @@ -815,18 +802,6 @@ def self.parse(data) next end end - begin - if param_attr.nil? - raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value") - end - - # 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} - param_attr = nil - qstr = nil - end end end end diff --git a/lib/mail/parsers/content_location_parser.rb b/lib/mail/parsers/content_location_parser.rb index e44824411..74179b6e4 100644 --- a/lib/mail/parsers/content_location_parser.rb +++ b/lib/mail/parsers/content_location_parser.rb @@ -589,7 +589,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 @@ -604,7 +604,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 @@ -757,9 +756,6 @@ def self.parse(data) next end end - begin - content_location.location = chars(data, token_string_s, p - 1) - end when 16 begin qstr_s = p diff --git a/lib/mail/parsers/content_transfer_encoding_parser.rb b/lib/mail/parsers/content_transfer_encoding_parser.rb index 2c8b535e1..78a6805cb 100644 --- a/lib/mail/parsers/content_transfer_encoding_parser.rb +++ b/lib/mail/parsers/content_transfer_encoding_parser.rb @@ -355,7 +355,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 diff --git a/lib/mail/parsers/content_type_parser.rb b/lib/mail/parsers/content_type_parser.rb index 6716bd7a9..5e0830318 100644 --- a/lib/mail/parsers/content_type_parser.rb +++ b/lib/mail/parsers/content_type_parser.rb @@ -709,7 +709,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 @@ -938,18 +937,6 @@ def self.parse(data) next end end - begin - if param_attr.nil? - raise Mail::Field::ParseError.new(Mail::ContentTypeElement, data, "no attribute for value") - end - - # 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} - param_attr = nil - qstr = nil - end when 24 begin end @@ -962,18 +949,6 @@ def self.parse(data) next end end - begin - if param_attr.nil? - raise Mail::Field::ParseError.new(Mail::ContentTypeElement, data, "no attribute for value") - end - - # 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} - param_attr = nil - qstr = nil - end end end end diff --git a/lib/mail/parsers/date_time_parser.rb b/lib/mail/parsers/date_time_parser.rb index 3696e57cd..49914c4b5 100644 --- a/lib/mail/parsers/date_time_parser.rb +++ b/lib/mail/parsers/date_time_parser.rb @@ -688,7 +688,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 @@ -833,9 +832,6 @@ def self.parse(data) next end end - begin - date_s = p - end when 7 begin end diff --git a/lib/mail/parsers/envelope_from_parser.rb b/lib/mail/parsers/envelope_from_parser.rb index b450f0c70..515e34c8c 100644 --- a/lib/mail/parsers/envelope_from_parser.rb +++ b/lib/mail/parsers/envelope_from_parser.rb @@ -3238,7 +3238,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 diff --git a/lib/mail/parsers/message_ids_parser.rb b/lib/mail/parsers/message_ids_parser.rb index 35e5a64df..386300478 100644 --- a/lib/mail/parsers/message_ids_parser.rb +++ b/lib/mail/parsers/message_ids_parser.rb @@ -4845,7 +4845,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 @@ -5108,11 +5107,6 @@ def self.parse(data) next end end - begin - id = chars(data, msg_id_s, p - 1) - id = $1 if id =~ /.*<(.*)>.*/ - message_ids.message_ids << id - end end end end diff --git a/lib/mail/parsers/mime_version_parser.rb b/lib/mail/parsers/mime_version_parser.rb index f7a1bd63a..fd3031713 100644 --- a/lib/mail/parsers/mime_version_parser.rb +++ b/lib/mail/parsers/mime_version_parser.rb @@ -319,7 +319,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 diff --git a/lib/mail/parsers/phrase_lists_parser.rb b/lib/mail/parsers/phrase_lists_parser.rb index 1d70d7086..1409d8d9f 100644 --- a/lib/mail/parsers/phrase_lists_parser.rb +++ b/lib/mail/parsers/phrase_lists_parser.rb @@ -699,7 +699,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 diff --git a/lib/mail/parsers/received_parser.rb b/lib/mail/parsers/received_parser.rb index b8e0ca425..1dcb1c19b 100644 --- a/lib/mail/parsers/received_parser.rb +++ b/lib/mail/parsers/received_parser.rb @@ -7511,7 +7511,6 @@ def self.parse(data) end begin - testEof = false _slen, _trans, _keys, _inds, _acts, _nacts = nil _goto_level = 0 _resume = 10 @@ -7857,9 +7856,6 @@ def self.parse(data) next end end - begin - date_s = p - end when 1 begin received_tokens_s = p @@ -8055,8 +8051,6 @@ def self.parse(data) next end end - begin - end when 114 begin end @@ -8088,10 +8082,6 @@ def self.parse(data) next end end - begin - end - begin - end when 2 begin received_tokens_s = p @@ -8105,10 +8095,6 @@ def self.parse(data) next end end - begin - end - begin - end when 37 begin end @@ -8212,10 +8198,6 @@ def self.parse(data) next end end - begin - end - begin - end when 88 begin end @@ -8310,12 +8292,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end when 103 begin begin @@ -8326,12 +8302,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end when 115 begin begin @@ -8342,12 +8312,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end when 44 begin end @@ -8416,12 +8380,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end when 109 begin end @@ -8434,12 +8392,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end when 123 begin end @@ -8452,12 +8404,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end when 113 begin end @@ -8538,12 +8484,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end when 34 begin end @@ -8565,14 +8505,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end - begin - end when 40 begin end @@ -8611,14 +8543,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end - begin - end when 27 begin end @@ -8644,14 +8568,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end - begin - end when 35 begin begin @@ -8662,16 +8578,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end - begin - end - begin - end when 12 begin begin @@ -8682,16 +8588,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end - begin - end - begin - end when 42 begin end @@ -8704,16 +8600,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end - begin - end - begin - end when 28 begin begin @@ -8724,18 +8610,6 @@ def self.parse(data) next end end - begin - end - begin - end - begin - end - begin - end - begin - end - begin - end end end end diff --git a/spec/mail/network/delivery_methods/smtp_connection_spec.rb b/spec/mail/network/delivery_methods/smtp_connection_spec.rb index 06aeaaeaf..22ac48424 100644 --- a/spec/mail/network/delivery_methods/smtp_connection_spec.rb +++ b/spec/mail/network/delivery_methods/smtp_connection_spec.rb @@ -16,8 +16,6 @@ end it "should not dot-stuff unterminated last line with no leading dot" do - body = "this is a test\n.\nonly a test" - Mail.deliver do from 'from@example.com' to 'to@example.com'