about summary refs log tree commit diff
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2024-04-26T00·49+0000
committeredef <edef@edef.eu>2024-04-26T06·56+0000
commita39894c158a84cf0bc1068e3eb5b71309b4adbff (patch)
tree00ae2ba3f0203919857abd878993b31b6633130b
parent89316b22bc4eb2ecadc63e2129648d2282b55174 (diff)
refactor(nix-compat/wire/bytes/reader): drop Pin::get_mut r/8014
Pin<&mut T> is DerefMut when T: Unpin, so we don't actually need to
explicitly call get_mut.

Change-Id: Iaa312ec49c87100010e09c94f319e57e31da0cd5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11520
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
-rw-r--r--tvix/nix-compat/src/wire/bytes/reader/mod.rs4
-rw-r--r--tvix/nix-compat/src/wire/bytes/reader/trailer.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/tvix/nix-compat/src/wire/bytes/reader/mod.rs b/tvix/nix-compat/src/wire/bytes/reader/mod.rs
index 8d4eab78f370..3bc8fcf688c4 100644
--- a/tvix/nix-compat/src/wire/bytes/reader/mod.rs
+++ b/tvix/nix-compat/src/wire/bytes/reader/mod.rs
@@ -93,11 +93,11 @@ where
 
 impl<R: AsyncRead + Unpin> AsyncRead for BytesReader<R> {
     fn poll_read(
-        self: Pin<&mut Self>,
+        mut self: Pin<&mut Self>,
         cx: &mut task::Context,
         buf: &mut ReadBuf,
     ) -> Poll<io::Result<()>> {
-        let this = &mut self.get_mut().state;
+        let this = &mut self.state;
 
         loop {
             match this {
diff --git a/tvix/nix-compat/src/wire/bytes/reader/trailer.rs b/tvix/nix-compat/src/wire/bytes/reader/trailer.rs
index d2b867c2c338..1a084d0eeb01 100644
--- a/tvix/nix-compat/src/wire/bytes/reader/trailer.rs
+++ b/tvix/nix-compat/src/wire/bytes/reader/trailer.rs
@@ -39,11 +39,11 @@ impl<R: AsyncRead + Unpin> TrailerReader<R> {
 
 impl<R: AsyncRead + Unpin> AsyncRead for TrailerReader<R> {
     fn poll_read(
-        self: Pin<&mut Self>,
+        mut self: Pin<&mut Self>,
         cx: &mut task::Context,
         user_buf: &mut ReadBuf,
     ) -> Poll<io::Result<()>> {
-        let this = self.get_mut();
+        let this = &mut *self;
 
         loop {
             match this {