message: nydus-image: simplify code in blob-compatct
  Simplify code in blob-compatct.
diff: @@ -303,20 +303,13 @@ impl BlobCompactor {
  for chunk_idx in 0..node.chunks.len() {
  let chunk = &mut node.chunks[chunk_idx];
  let chunk_key = ChunkKey::from(&chunk.inner);
  - if !matches!(
  - self.states[chunk.inner.blob_index() as usize],
  - Some(State::ChunkDict)
  - ) {
  + if let Some(State::ChunkDict) = self.states[chunk.inner.blob_index() as usize] {
  // dedup by chunk dict
  if let Some(c) = chunk_dict.get_chunk(chunk.inner.id()) {
  apply_chunk_change(c, &mut chunk.inner)?;
  - } else {
  - match all_chunks.get_chunk(&chunk_key) {
  - Some(c) => {
  - // do dedup
  + } else if let Some(c) = all_chunks.get_chunk(&chunk_key) {
  apply_chunk_change(c, &mut chunk.inner)?;
  - }
  - None => {
  + } else {
  all_chunks.add_chunk(&chunk.inner);
  // add to per blob ChunkSet
  let blob_index = chunk.inner.blob_index() as usize;
  @@ -328,29 +321,20 @@ impl BlobCompactor {
  cs.add_chunk(&chunk.inner);
  }
  }
  - };
  - }
  }
  +
  // construct blobs/chunk --> nodes index map
  - match self.c2nodes.get_mut(&chunk_key) {
  - None => {
  - self.c2nodes.insert(chunk_key, vec![(node_idx, chunk_idx)]);
  - }
  - Some(list) => {
  - list.push((node_idx, chunk_idx));
  - }
  - };
  - match self.b2nodes.get_mut(&chunk.inner.blob_index()) {
  - None => {
  + self.c2nodes
  + .entry(chunk_key)
  + .or_insert(vec![])
  + .push((node_idx, chunk_idx));
  self.b2nodes
  - .insert(chunk.inner.blob_index(), vec![(node_idx, chunk_idx)]);
  - }
  - Some(list) => {
  - list.push((node_idx, chunk_idx));
  - }
  - }
  + .entry(chunk.inner.blob_index())
  + .or_insert(vec![])
  + .push((node_idx, chunk_idx));
  }
  }
  +
  Ok(())
  }
  