Enforce Rust and Swift ownership boundary
This commit is contained in:
@@ -80,6 +80,12 @@ pub struct IssueFilter {
|
||||
pub labels: BTreeSet<String>,
|
||||
}
|
||||
|
||||
impl IssueFilter {
|
||||
pub fn is_active(&self, status: &str) -> bool {
|
||||
status != "open" || self != &Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RepositoryData {
|
||||
pub owner: String,
|
||||
@@ -132,3 +138,21 @@ pub struct PullDetails {
|
||||
pub fn open_status() -> String {
|
||||
"open".into()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn issue_filter_default_state_is_owned_by_rust() {
|
||||
assert!(!IssueFilter::default().is_active("open"));
|
||||
assert!(IssueFilter::default().is_active("closed"));
|
||||
assert!(
|
||||
IssueFilter {
|
||||
milestone: "v1".into(),
|
||||
..Default::default()
|
||||
}
|
||||
.is_active("open")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user