Fix master by reverting ContactId Display impl (#3134)

Actual fix needs more investigation, it's not obvious.
This commit is contained in:
Floris Bruynooghe
2022-03-17 19:29:18 +01:00
committed by GitHub
parent cc55be0b0a
commit e2d631097d

View File

@@ -15,9 +15,8 @@ use crate::chat::ChatId;
use crate::color::str_to_color; use crate::color::str_to_color;
use crate::config::Config; use crate::config::Config;
use crate::constants::{ use crate::constants::{
Blocked, Chattype, DC_CONTACT_ID_DEVICE, DC_CONTACT_ID_DEVICE_ADDR, DC_CONTACT_ID_INFO, Blocked, Chattype, DC_CONTACT_ID_DEVICE, DC_CONTACT_ID_DEVICE_ADDR, DC_CONTACT_ID_LAST_SPECIAL,
DC_CONTACT_ID_LAST_SPECIAL, DC_CONTACT_ID_SELF, DC_CONTACT_ID_UNDEFINED, DC_GCL_ADD_SELF, DC_CONTACT_ID_SELF, DC_GCL_ADD_SELF, DC_GCL_VERIFIED_ONLY,
DC_GCL_VERIFIED_ONLY,
}; };
use crate::context::Context; use crate::context::Context;
use crate::dc_tools::{dc_get_abs_path, improve_single_line_input, EmailAddress}; use crate::dc_tools::{dc_get_abs_path, improve_single_line_input, EmailAddress};
@@ -53,19 +52,20 @@ impl ContactId {
impl fmt::Display for ContactId { impl fmt::Display for ContactId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if *self == DC_CONTACT_ID_UNDEFINED { write!(f, "{}", self.0)
write!(f, "Contact#Undefined") // if *self == DC_CONTACT_ID_UNDEFINED {
} else if *self == DC_CONTACT_ID_SELF { // write!(f, "Contact#Undefined")
write!(f, "Contact#Self") // } else if *self == DC_CONTACT_ID_SELF {
} else if *self == DC_CONTACT_ID_INFO { // write!(f, "Contact#Self")
write!(f, "Contact#Info") // } else if *self == DC_CONTACT_ID_INFO {
} else if *self == DC_CONTACT_ID_DEVICE { // write!(f, "Contact#Info")
write!(f, "Contact#Device") // } else if *self == DC_CONTACT_ID_DEVICE {
} else if *self <= DC_CONTACT_ID_LAST_SPECIAL { // write!(f, "Contact#Device")
write!(f, "Contact#Special{}", self.0) // } else if *self <= DC_CONTACT_ID_LAST_SPECIAL {
} else { // write!(f, "Contact#Special{}", self.0)
write!(f, "Contact#{}", self.0) // } else {
} // write!(f, "Contact#{}", self.0)
// }
} }
} }