]> git.proxmox.com Git - proxmox.git/commitdiff
tfa: serde tools: improve variance and dropck
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 22 Mar 2022 11:29:59 +0000 (12:29 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 22 Mar 2022 11:31:54 +0000 (12:31 +0100)
`FoldSeqVisitor` doesn't actually own a `T` and therefore
cannot drop a `T`, we only use it via the `Fn(&mut Out, T)`,
so use `fn(T)` in the `PhantomData` to keep `T`
contravariant.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
proxmox-tfa/src/api/serde_tools.rs

index 39f1f4ae6eb73c4bad4c2eaf0788cfc9cc052ff3..8fbe0fc296ae53c69b38242bcf147c2c8381ff51 100644 (file)
@@ -17,7 +17,7 @@ where
     init: Option<Init>,
     closure: F,
     expecting: &'static str,
-    _ty: PhantomData<T>,
+    _ty: PhantomData<fn(T)>,
 }
 
 impl<T, Out, F, Init> FoldSeqVisitor<T, Out, F, Init>