code: func (s *SyncState) maybePruneModule(addr addrs.ModuleInstance) {
  	if addr.IsRoot() {
  		// We never prune the root.
  		return
  	}
  
  	ms := s.state.Module(addr)
  	if ms == nil {
  		return
  	}
  
  	if ms.empty() {
  		log.Printf("[TRACE] states.SyncState: pruning %s because it is empty", addr)
  		s.state.RemoveModule(addr)
  	}
  }
docs: // maybePruneModule will remove a module from the state altogether if it is
  // empty, unless it's the root module which must always be present.
  //
  // This helper method is not concurrency-safe on its own, so must only be
  // called while the caller is already holding the lock for writing.