Repository: paritytech/substrate
File: frame/nfts/src/features/create_delete_item.rs (Rust)

Code before:
					collection,
					Some(item),
					AttributeNamespace::CollectionOwner,
					Self::construct_attribute_key(key)?,
					Self::construct_attribute_value(value)?,
					mint_to.clone(),
				)?;
			}
			if !metadata.len().is_zero() {
				Self::do_set_item_metadata(
					Some(admin_account.clone()),
					collection,
					item,
					metadata,
					Some(mint_to.clone()),
				)?;
			}
		}
		Ok(())
	}

	/// Burns the specified item with the given `collection`, `item`, and `with_details`.
	///
	/// # Errors
	///
	/// This function returns an error in the following cases:
	/// - If the collection ID is invalid (`UnknownCollection`)
	/// - If the item is locked (`ItemLocked`)
	pub fn do_burn(
		collection: T::CollectionId,
		item: T::ItemId,
		with_details: impl FnOnce(&ItemDetailsFor<T, I>) -> DispatchResult,
	) -> DispatchResult {
		ensure!(!T::Locker::is_locked(collection, item), Error::<T, I>::ItemLocked);
		ensure!(
			!Self::has_system_attribute(&collection, &item, PalletAttributes::TransferDisabled)?,
			Error::<T, I>::ItemLocked
		);
		let item_config = Self::get_item_config(&collection, &item)?;
		// NOTE: if item's settings are not empty (e.g. item's metadata is locked)
		// then we keep the config record and don't remove it
		let remove_config = !item_config.has_disabled_settings();
		let owner = Collection::<T, I>::try_mutate(
			&collection,
			|maybe_collection_details| -> Result<T::AccountId, DispatchError> {
				let collection_details =
					maybe_collection_details.as_mut().ok_or(Error::<T, I>::UnknownCollection)?;
				let details = Item::<T, I>::get(&collection, &item)
					.ok_or(Error::<T, I>::UnknownCollection)?;
				with_details(&details)?;


Review comment (suggestion):
```suggestion
	/// This function returns a `Dispatch` error in the following cases:
```

Code after:
				Self::do_set_attribute(
					admin_account.clone(),
					collection,
					Some(item),
					AttributeNamespace::CollectionOwner,
					Self::construct_attribute_key(key)?,
					Self::construct_attribute_value(value)?,
					mint_to.clone(),
				)?;
			}
			if !metadata.len().is_zero() {
				Self::do_set_item_metadata(
					Some(admin_account.clone()),
					collection,
					item,
					metadata,
					Some(mint_to.clone()),
				)?;
			}
		}
		Ok(())
	}

	/// Burns the specified item with the given `collection`, `item`, and `with_details`.
	///
	/// # Errors
	///
	/// This function returns a dispatch error in the following cases:
	/// - If the collection ID is invalid ([`UnknownCollection`](crate::Error::UnknownCollection)).
	/// - If the item is locked ([`ItemLocked`](crate::Error::ItemLocked)).
	pub fn do_burn(
		collection: T::CollectionId,
		item: T::ItemId,
		with_details: impl FnOnce(&ItemDetailsFor<T, I>) -> DispatchResult,
	) -> DispatchResult {
		ensure!(!T::Locker::is_locked(collection, item), Error::<T, I>::ItemLocked);
		ensure!(
			!Self::has_system_attribute(&collection, &item, PalletAttributes::TransferDisabled)?,
			Error::<T, I>::ItemLocked
		);
		let item_config = Self::get_item_config(&collection, &item)?;
		// NOTE: if item's settings are not empty (e.g. item's metadata is locked)
		// then we keep the config record and don't remove it
		let remove_config = !item_config.has_disabled_settings();
		let owner = Collection::<T, I>::try_mutate(
			&collection,
			|maybe_collection_details| -> Result<T::AccountId, DispatchError> {
				let collection_details =
					maybe_collection_details.as_mut().ok_or(Error::<T, I>::UnknownCollection)?;
				let details = Item::<T, I>::get(&collection, &item)
					.ok_or(Error::<T, I>::UnknownCollection)?;