File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,26 @@ impl<'repo> Submodule<'repo> {
37
37
38
38
/// Get the submodule's url.
39
39
///
40
- /// Returns `None` if the url is not valid utf-8
41
- pub fn url ( & self ) -> Option < & str > { str:: from_utf8 ( self . url_bytes ( ) ) . ok ( ) }
40
+ /// Returns `None` if the url is not valid utf-8 or if the URL isn't present
41
+ pub fn url ( & self ) -> Option < & str > {
42
+ self . opt_url_bytes ( ) . and_then ( |b| str:: from_utf8 ( b) . ok ( ) )
43
+ }
42
44
43
45
/// Get the url for the submodule.
46
+ #[ doc( hidden) ]
47
+ #[ deprecated( note = "renamed to `opt_url_bytes`" ) ]
44
48
pub fn url_bytes ( & self ) -> & [ u8 ] {
49
+ self . opt_url_bytes ( ) . unwrap ( )
50
+ }
51
+
52
+ /// Get the url for the submodule.
53
+ ///
54
+ /// Returns `None` if the URL isn't present
55
+ // TODO: delete this method and fix the signature of `url_bytes` on next
56
+ // major version bump
57
+ pub fn opt_url_bytes ( & self ) -> Option < & [ u8 ] > {
45
58
unsafe {
46
- :: opt_bytes ( self , raw:: git_submodule_url ( self . raw ) ) . unwrap ( )
59
+ :: opt_bytes ( self , raw:: git_submodule_url ( self . raw ) )
47
60
}
48
61
}
49
62
You can’t perform that action at this time.
0 commit comments