Repository: qdrant/qdrant
File: lib/collection/src/config.rs (Rust)

Code before:

            let vector_quantization =
                vector_config.quantization_config.is_some() || self.quantization_config.is_some();

            if vector_hnsw.copy_vectors.unwrap_or_default() {
                if !vector_quantization {
                    writeln!(
                        &mut messages,
                        "The `hnsw_config.copy_vectors` option for vector '{vector_name}' \
                         requires quantization to be enabled. This option will be ignored."
                    )
                    .unwrap();
                }
                if vector_config.multivector_config.is_some() {
                    writeln!(
                        &mut messages,
                        "The `hnsw_config.copy_vectors` option for vector '{vector_name}' \
                         is not compatible with multivectors. This option will be ignored."
                    )
                    .unwrap();
                }
            }
        }

        if !messages.is_empty() {
            messages.pop(); // trim the last newline
            ConfigurationStatus::Warning(messages)
        } else {
            ConfigurationStatus::Ok
        }
    }

    pub fn to_base_segment_config(&self) -> CollectionResult<SegmentConfig> {
        self.params
            .to_base_segment_config(self.quantization_config.as_ref())
    }
}

impl CollectionParams {
    pub fn empty() -> Self {
        CollectionParams {
            vectors: Default::default(),
            shard_number: default_shard_number(),
            sharding_method: None,
            replication_factor: default_replication_factor(),
            write_consistency_factor: default_write_consistency_factor(),
            read_fan_out_factor: None,
            on_disk_payload: default_on_disk_payload(),
            sparse_vectors: None,
        }
    }

Review comment (suggestion):
Why not push each individual message in a `Vec`, and use `messages.join("\n")`. Popping the new line coming from the last write is a bit of a hack to me.

Code after:
            let vector_quantization =
                vector_config.quantization_config.is_some() || self.quantization_config.is_some();

            if vector_hnsw.copy_vectors.unwrap_or_default() {
                if !vector_quantization {
                    warnings.push(CollectionWarning {
                        message: format!(
                            "The `hnsw_config.copy_vectors` option for vector '{vector_name}' \
                             requires quantization to be enabled. This option will be ignored."
                        ),
                    });
                }
                if vector_config.multivector_config.is_some() {
                    warnings.push(CollectionWarning {
                        message: format!(
                            "The `hnsw_config.copy_vectors` option for vector '{vector_name}' \
                             is not compatible with multivectors. This option will be ignored."
                        ),
                    });
                }
            }
        }

        warnings
    }

    pub fn to_base_segment_config(&self) -> CollectionResult<SegmentConfig> {
        self.params
            .to_base_segment_config(self.quantization_config.as_ref())
    }
}

impl CollectionParams {
    pub fn empty() -> Self {
        CollectionParams {
            vectors: Default::default(),
            shard_number: default_shard_number(),
            sharding_method: None,
            replication_factor: default_replication_factor(),
            write_consistency_factor: default_write_consistency_factor(),
            read_fan_out_factor: None,
            on_disk_payload: default_on_disk_payload(),
            sparse_vectors: None,
        }
    }

    fn missing_vector_error(&self, vector_name: &VectorName) -> CollectionError {
        let mut available_names = vec![];

        match &self.vectors {
            VectorsConfig::Single(_) => {