parameters: (build_source_dir, dep_to_git)
return_statement: return dep_to_crates
docstring: This function traverse the build_source_dir in search of Cargo.toml
          files, extracts the crate names from them using _extract_crates
          function and returns a merged result containing crate names per
          dependency name from all Cargo.toml files in the project.
docstring_summary: This function traverse the build_source_dir in search of Cargo.toml
          files, extracts the crate names from them using _extract_crates
          function and returns a merged result containing crate names per
          dependency name from all Cargo.toml files in the project.
docstring_tokens: This function traverse the build_source_dir in search of Cargo . toml files extracts the crate names from them using _extract_crates function and returns a merged result containing crate names per dependency name from all Cargo . toml files in the project .
function: def _resolve_dep_to_crates(build_source_dir, dep_to_git):
          """
          This function traverse the build_source_dir in search of Cargo.toml
          files, extracts the crate names from them using _extract_crates
          function and returns a merged result containing crate names per
          dependency name from all Cargo.toml files in the project.
          """
          if not dep_to_git:
              return {}  # no deps, so don't waste time traversing files
  
          dep_to_crates = {}
          for root, _, files in os.walk(build_source_dir):
              for f in files:
                  if f == "Cargo.toml":
                      more_dep_to_crates = CargoBuilder._extract_crates(
                          os.path.join(root, f), dep_to_git
                      )
                      for name, crates in more_dep_to_crates.items():
                          dep_to_crates.setdefault(name, set()).update(crates)
          return dep_to_crates
function_tokens: def _resolve_dep_to_crates ( build_source_dir , dep_to_git ) : if not dep_to_git : return { } # no deps, so don't waste time traversing files dep_to_crates = { } for root , _ , files in os . walk ( build_source_dir ) : for f in files : if f == "Cargo.toml" : more_dep_to_crates = CargoBuilder . _extract_crates ( os . path . join ( root , f ) , dep_to_git ) for name , crates in more_dep_to_crates . items ( ) : dep_to_crates . setdefault ( name , set ( ) ) . update ( crates ) return dep_to_crates