As this error is only used for `Permission`, it's clear that it contains a `Permission` instance.
Unified · Split
| @@ -7,18 +7,18 @@ use std::fmt::{Display, Formatter}; · 6 unmodified lines | ||
| 7 | 7 | /// causes errors. |
| 8 | 8 | #[derive(Debug, thiserror::Error)] |
| 9 | 9 | #[error("Not allowed to handle resource {:?}: permission {}", .resource, .permission)] |
| 10 | −pub struct Error<R: std::fmt::Debug, P: std::fmt::Debug + Display> { | |
| 10 | +pub struct Error<R: std::fmt::Debug> { | |
| 11 | 11 | /// The resource which cannot be used. |
| 12 | 12 | pub resource: R, |
| 13 | 13 | /// The permission causing it to be disallowed. |
| 14 | − pub permission: P, | |
| 14 | + pub permission: Permission, | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | impl Permission { |
| 18 | 18 | /// Check this permissions and produce a reply to indicate if the `resource` can be used and in which way. |
| 19 | 19 | /// |
| 20 | 20 | /// Only if this permission is set to `Allow` will the resource be usable. |
| 21 | − pub fn check<R: std::fmt::Debug>(&self, resource: R) -> Result<Option<R>, Error<R, Self>> { | |
| 21 | + pub fn check<R: std::fmt::Debug>(&self, resource: R) -> Result<Option<R>, Error<R>> { | |
| 22 | 22 | match self { |
| 23 | 23 | Permission::Allow => Ok(Some(resource)), |
| 24 | 24 | Permission::Deny => Ok(None), |