-
Notifications
You must be signed in to change notification settings - Fork 10
[PM-21691] - Added tree and test with implementation for CollectionView #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Great job, no security vulnerabilities found in this Pull Request |
d1e534f
to
b0dbb1c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #279 +/- ##
==========================================
+ Coverage 70.32% 70.49% +0.17%
==========================================
Files 217 221 +4
Lines 16992 17209 +217
==========================================
+ Hits 11949 12132 +183
- Misses 5043 5077 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor comments, but very nice overall, +1 for the tests 👍
crates/bitwarden-vault/src/tree.rs
Outdated
} | ||
|
||
impl<T: TreeItem> Tree<T> { | ||
pub fn from_items(items: &mut Vec<T>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I would take the value here since we are modifying it in unexpected ways inside of the function (sorting). It might also mean that we can get away with not cloning the items when you put them in the tree since you'd have ownership of them
crates/bitwarden-vault/src/tree.rs
Outdated
pub fn new<T: TreeItem>(id: usize, parent_idx: Option<usize>, children_idx: Vec<usize>, index: TreeIndex<T>) -> Self { | ||
TreeNode { | ||
id, | ||
item_id: index.data.id().unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: unwrap is not allowed
suggestion: either remove the ability for this to be optional or use Result:Err
somehow
crates/bitwarden-vault/src/tree.rs
Outdated
let node_option = Tree::from_items(&mut items) | ||
.get_item_by_id(child_1_id); | ||
|
||
if let Some(node) = node_option { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: same here, simplify with expect
Co-authored-by: Andreas Coroiu <[email protected]>
# Conflicts: # crates/bitwarden-vault/src/lib.rs
…dings to attempt to solve compile issue.
# Conflicts: # crates/bitwarden-collections/src/collection.rs
|
🎟️ Tracking
PM-21691
📔 Objective
This splits the collections code out of the vault crate and adds a Tree implementation for representing the parent child relationship between nested collections.
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes