History

change!: `permission::Error<R>` with only one generic parameter (#450)

As this error is only used for `Permission`, it's clear that it contains a `Permission` instance.

Sebastian Thiel committed 4 years ago

Commit 51c721c1 parent 0ce21b11 file · +3 −3Browse files

Unified · Split

git-sec/src/permission.rs+3−3
@@ -7,18 +7,18 @@ use std::fmt::{Display, Formatter}; · 6 unmodified lines
77 /// causes errors.
88 #[derive(Debug, thiserror::Error)]
99 #[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> {
1111 /// The resource which cannot be used.
1212 pub resource: R,
1313 /// The permission causing it to be disallowed.
14− pub permission: P,
14+ pub permission: Permission,
1515 }
1616
1717 impl Permission {
1818 /// Check this permissions and produce a reply to indicate if the `resource` can be used and in which way.
1919 ///
2020 /// 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>> {
2222 match self {
2323 Permission::Allow => Ok(Some(resource)),
2424 Permission::Deny => Ok(None),