-
Notifications
You must be signed in to change notification settings - Fork 30
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
Remove cloning #106
Conversation
@na-g it's not fully at what we talked about it, but hopefully a step in the right direction. What do you think? |
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.
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(_) |
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.
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.
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.
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()), |
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.
"string to short" -> "string too short"
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.
Thanks. Fixed.
Ha, awesome. Yes another clone() call gone. Thank you! |
Improved proper ownership and removed as many direct clone() calls as possible.