diff --git a/capnp/src/lib.rs b/capnp/src/lib.rs index 22aa8aef0..daafc23c1 100644 --- a/capnp/src/lib.rs +++ b/capnp/src/lib.rs @@ -401,6 +401,7 @@ pub enum ErrorKind { impl Error { /// Writes to the `extra` field. Does nothing if the "alloc" feature is not enabled. + /// This is intended to be used with the `write!()` macro from core. pub fn write_fmt(&mut self, fmt: core::fmt::Arguments<'_>) { #[cfg(feature = "alloc")] { diff --git a/capnp/src/schema.rs b/capnp/src/schema.rs index 2ed5f5c9a..8750a0a66 100644 --- a/capnp/src/schema.rs +++ b/capnp/src/schema.rs @@ -70,8 +70,6 @@ impl StructSchema { if let Some(field) = self.find_field_by_name(name)? { Ok(field) } else { - // error needs to be mutable only when the alloc feature is enabled - #[allow(unused_mut)] let mut error = crate::Error::from_kind(crate::ErrorKind::FieldNotFound); write!(error, "{}", name); Err(error)