Skip to content
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

Remove cloning #106

Merged
merged 7 commits into from
Apr 22, 2019
Merged

Remove cloning #106

merged 7 commits into from
Apr 22, 2019

Conversation

nils-ohlmeier
Copy link
Collaborator

Improved proper ownership and removed as many direct clone() calls as possible.

@nils-ohlmeier
Copy link
Collaborator Author

@na-g it's not fully at what we talked about it, but hopefully a step in the right direction. What do you think?

Copy link
Collaborator

@na-g na-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it won't let me leave an inline comment that isn't close to one of the lines that you edited (grrr...), you can change line 1085 of lib.rs to return Err(warnings.remove(0));, and remove #derive(Clone) from SdpParserError, then LGTM.

});
}
// the line parsers throw unsupported errors for these already
SdpType::Email(_)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these SDP types throw parsing errors, then they should be removed from the enum, and that way we don't have to worry about illegal state everywhere we use this enum. This follows the '"make the impossible inexpressible" rule of thumb. That could be handled in another bug though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea. I created issue #107 for that!

src/lib.rs Outdated
@@ -1011,7 +1026,7 @@ pub fn parse_sdp(sdp: &str, fail_on_warning: bool) -> Result<SdpSession, SdpPars
line_number: 0,
});
}
if sdp.len() < 62 {
if sdp.len() < 40 {
return Err(SdpParserError::Line {
error: SdpParserInternalError::Generic("string to short to be valid SDP".to_string()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"string to short" -> "string too short"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Fixed.

@nils-ohlmeier
Copy link
Collaborator Author

While it won't let me leave an inline comment that isn't close to one of the lines that you edited (grrr...), you can change line 1085 of lib.rs to return Err(warnings.remove(0));, and remove #derive(Clone) from SdpParserError, then LGTM.

Ha, awesome. Yes another clone() call gone. Thank you!

@nils-ohlmeier nils-ohlmeier merged commit 712cd5b into master Apr 22, 2019
@nils-ohlmeier nils-ohlmeier deleted the remove_cloning branch April 23, 2019 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants