work
[pspp] / rust / src / identifier.rs
index 5b0649f533ac99f56c1bbaf9101ef5404fa90142..8727bf1ea360454bdc15a911dc7ec1a0cd563f49 100644 (file)
@@ -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()))
     }