Conversation
|
Thanks @yjh0502. I'm a bit unhappy that there were so many formatting-only changes that it took some time to spot the actual changes you made. There are some things I'd have mentioned in this comment but I will do a proper code-review instead and annotate the patch. |
| ptrs.push(ptr); | ||
| } | ||
| pub fn new(cursors: &'a [Cursor<'a>]) -> MultiCursor<'a> { | ||
| use std::iter::FromIterator; |
There was a problem hiding this comment.
Is there a reason you put the FromIterator inclusion into the method itself?
There was a problem hiding this comment.
The trait is only used for the method, so I thought it's better to include the trait inside the method. We could also use cursors.into_iter().collect() instead of Self::from_iter(cursors). Does it sound better?
| let mut multi_cursor = MultiCursor::new(&cursors); | ||
| let mut cursor1 = cursors[0].borrow_mut(); | ||
| let mut cursor2 = cursors[1].borrow_mut(); | ||
| let mut cursors = vec![db.cursor(), db.cursor()]; |
|
Is there a particular rustfmt configuration you used for the reformatted methods or did you do that manually? If it was for me I'd apply that formatting project-wide. |
|
I'll keep this pending for a few days to give @knutin the ability to chime in. |
|
Sorry for noisy patch. I should made seperated |
|
Looks good, thanks for the patch @yjh0502! Maybe we should just remove the |
Yeah, sorry. I started this project when I had lots of opinions and little experience. These days I never customize |
MultiCursor is currently unsound because of wrong lifetime. For example following example crashes with use-after-free.
with valgrind output
I make following changes