From 0b3f2a55dfa8d1a2a8ebe03848589182591f846f Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 16 Nov 2019 13:40:02 +0300 Subject: [PATCH] Do not use wildcard match in msgtype_has_file This way there will be a compiler error notifying that the function needs to be updated when a new message type is added. --- src/chat.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chat.rs b/src/chat.rs index 712ce556b..54c4e8d81 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -690,6 +690,8 @@ pub fn prepare_msg<'a>( pub fn msgtype_has_file(msgtype: Viewtype) -> bool { match msgtype { + Viewtype::Unknown => false, + Viewtype::Text => false, Viewtype::Image => true, Viewtype::Gif => true, Viewtype::Sticker => true, @@ -697,7 +699,6 @@ pub fn msgtype_has_file(msgtype: Viewtype) -> bool { Viewtype::Voice => true, Viewtype::Video => true, Viewtype::File => true, - _ => false, } }