@@ -57,6 +57,7 @@ fn shallow_filter(shallow: &bool) -> bool {
5757}
5858
5959// Just a type wrapper around str to make it clear what we're working with
60+ /// A type alias for submodule names used throughout the configuration.
6061pub type SubmoduleName = String ;
6162
6263/// Git options for a submodule
@@ -76,6 +77,7 @@ pub struct SubmoduleGitOptions {
7677 pub update : Option < SerializableUpdate > ,
7778}
7879
80+ #[ allow( dead_code) ]
7981impl SubmoduleGitOptions {
8082 /// Create a new instance with defaults
8183 pub fn new (
@@ -104,6 +106,7 @@ impl SubmoduleGitOptions {
104106}
105107
106108/// Convert git submodule options to git2-compatible options
109+ #[ allow( dead_code) ]
107110pub struct Git2SubmoduleOptions {
108111 ignore : git2:: SubmoduleIgnore ,
109112 update : git2:: SubmoduleUpdate ,
@@ -112,7 +115,9 @@ pub struct Git2SubmoduleOptions {
112115}
113116
114117/// Implementation for converting git2 submodule options
118+ #[ allow( dead_code) ]
115119impl Git2SubmoduleOptions {
120+ /// Create a new `Git2SubmoduleOptions` from individual git2 option values.
116121 pub fn new (
117122 ignore : git2:: SubmoduleIgnore ,
118123 update : git2:: SubmoduleUpdate ,
@@ -171,6 +176,7 @@ impl Iterator for SubmoduleDefaults {
171176 }
172177}
173178
179+ #[ allow( dead_code) ]
174180impl SubmoduleDefaults {
175181 /// Returns a vector of SubmoduleDefaults with the current values (for comparison)
176182 pub fn get_values ( & self ) -> Vec < SubmoduleDefaults > {
@@ -223,9 +229,11 @@ pub struct SubmoduleAddOptions {
223229 /// Whether to create a shallow clone
224230 pub shallow : bool ,
225231 /// Whether to skip initialization after adding
232+ #[ allow( dead_code) ]
226233 pub no_init : bool ,
227234}
228235
236+ #[ allow( dead_code) ]
229237impl SubmoduleAddOptions {
230238 /// Create an add options from a SubmoduleEntry
231239 pub fn into_submodule_entry ( self ) -> SubmoduleEntry {
@@ -282,6 +290,7 @@ pub struct SubmoduleUpdateOptions {
282290 pub force : bool ,
283291}
284292
293+ #[ allow( dead_code) ]
285294impl SubmoduleUpdateOptions {
286295 /// Create a new instance with defaults
287296 pub fn new ( strategy : SerializableUpdate , recursive : bool , force : bool ) -> Self {
@@ -349,6 +358,7 @@ pub struct OtherSubmoduleSettings {
349358 pub no_init : bool ,
350359}
351360
361+ #[ allow( dead_code) ]
352362impl OtherSubmoduleSettings {
353363 /// Create a new instance with default values
354364 fn default ( ) -> Self {
@@ -452,6 +462,7 @@ pub struct SubmoduleEntry {
452462 pub sparse_paths : Option < Vec < String > > ,
453463}
454464
465+ #[ allow( dead_code) ]
455466impl SubmoduleEntry {
456467 /// Create a new submodule entry with defaults
457468 pub fn new (
@@ -597,6 +608,7 @@ impl SubmoduleEntry {
597608 url. rsplit ( & [ '/' , ':' ] [ ..] ) . next ( ) . unwrap_or ( "" ) . to_string ( )
598609 }
599610
611+ /// Returns the git-specific options for this submodule entry.
600612 pub fn git_options ( & self ) -> SubmoduleGitOptions {
601613 SubmoduleGitOptions {
602614 ignore : self . ignore . clone ( ) ,
@@ -606,6 +618,7 @@ impl SubmoduleEntry {
606618 }
607619 }
608620
621+ /// Returns the non-git settings for this submodule entry (path, url, active state, etc.).
609622 pub fn settings ( & self ) -> OtherSubmoduleSettings {
610623 OtherSubmoduleSettings {
611624 name : None , // We don't have a name in this struct, so we leave it as None
@@ -703,6 +716,7 @@ impl Serialize for SubmoduleEntries {
703716 }
704717}
705718
719+ #[ allow( dead_code) ]
706720impl SubmoduleEntries {
707721 /// Create a new empty SubmoduleEntries
708722 pub fn new (
@@ -715,6 +729,7 @@ impl SubmoduleEntries {
715729 }
716730 }
717731
732+ /// Create a new empty `SubmoduleEntries` with default (empty) collections.
718733 pub fn default ( ) -> Self {
719734 Self {
720735 submodules : Some ( HashMap :: new ( ) ) ,
@@ -749,6 +764,7 @@ impl SubmoduleEntries {
749764 self . clone ( )
750765 }
751766
767+ /// Returns a list of all submodule names, or `None` if no submodules are configured.
752768 pub fn submodule_names ( & self ) -> Option < Vec < String > > {
753769 self . submodules
754770 . as_ref ( )
@@ -823,6 +839,7 @@ impl SubmoduleEntries {
823839 self . submodules . as_ref ( ) ?. get ( name)
824840 }
825841
842+ /// Returns `true` if a submodule with the given name exists.
826843 pub fn contains_key ( & self , name : & str ) -> bool {
827844 self . submodules
828845 . as_ref ( )
@@ -910,6 +927,7 @@ pub struct Config {
910927 pub submodules : SubmoduleEntries ,
911928}
912929
930+ #[ allow( dead_code) ]
913931impl Config {
914932 /// Create a new configuration with the given defaults and submodules
915933 pub fn new ( defaults : SubmoduleDefaults , submodules : SubmoduleEntries ) -> Self {
0 commit comments