X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=rust%2Fsrc%2Fidentifier.rs;h=8727bf1ea360454bdc15a911dc7ec1a0cd563f49;hb=e0cbdf0daefcca81be9572aab0deedf945687f5a;hp=5b0649f533ac99f56c1bbaf9101ef5404fa90142;hpb=c953078638501b58b8efbdfebb05559103a7a3b6;p=pspp diff --git a/rust/src/identifier.rs b/rust/src/identifier.rs index 5b0649f533..8727bf1ea3 100644 --- a/rust/src/identifier.rs +++ b/rust/src/identifier.rs @@ -84,18 +84,30 @@ impl Identifier { let (encoded, _, unencodable) = encoding.encode(s); if unencodable { let mut encoder = encoding.new_encoder(); - let mut buf = - Vec::with_capacity(encoder.max_buffer_length_from_utf8_without_replacement(s.len()).unwrap()); + let mut buf = Vec::with_capacity( + encoder + .max_buffer_length_from_utf8_without_replacement(s.len()) + .unwrap(), + ); let EncoderResult::Unmappable(c) = encoder .encode_from_utf8_to_vec_without_replacement(s, &mut buf, true) .0 else { unreachable!(); }; - return Err(Error::NotEncodable { id: s.into(), encoding: encoding.name(), c }); + return Err(Error::NotEncodable { + id: s.into(), + encoding: encoding.name(), + c, + }); } if encoded.len() > Self::MAX_LEN { - return Err(Error::TooLong { id: s.into(), length: encoded.len(), encoding: encoding.name(), max: Self::MAX_LEN }); + return Err(Error::TooLong { + id: s.into(), + length: encoded.len(), + encoding: encoding.name(), + max: Self::MAX_LEN, + }); } Ok(Identifier(s.into())) }