Skip to content

Commit

Permalink
refactor: remove partial clone
Browse files Browse the repository at this point in the history
  • Loading branch information
apskhem committed Mar 12, 2024
1 parent 21b9d61 commit b9bd2aa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/analyzer/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ impl Indexer {
schema,
name,
..
} = r#enum.ident.clone();
} = &r#enum.ident;

let schema = schema
.clone()
.as_ref()
.map(|s| s.to_string.clone())
.unwrap_or_else(|| DEFAULT_SCHEMA.into());

Expand Down Expand Up @@ -222,7 +222,7 @@ impl Indexer {
enum_name: &String,
values: &Vec<String>,
) -> (bool, (bool, Vec<bool>)) {
let schema = schema.clone().unwrap_or_else(|| DEFAULT_SCHEMA.into());
let schema = schema.clone().unwrap_or_else(|| DEFAULT_SCHEMA.to_string());

match self.schema_map.get(&schema) {
Some(block) => {
Expand Down Expand Up @@ -357,7 +357,7 @@ impl IndexedRef {
tables
.iter()
.find(|table| {
table.ident.schema.clone().map(|s| s.to_string) == ref_ident.schema.clone().map(|s| s.to_string)
table.ident.schema.as_ref().map(|s| &s.to_string) == ref_ident.schema.as_ref().map(|s| &s.to_string)
&& table.ident.name.to_string == ref_ident.table.to_string
})
.map(Ok)
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ pub fn analyze(schema_block: &SchemaBlock) -> AnalyzerResult<AnalyzedIndexer> {
.collect::<AnalyzerResult<_>>()?;

// validate ref
for indexed_ref in indexed_refs.clone() {
for indexed_ref in &indexed_refs {
indexed_ref.validate_ref_type(&tables, &indexer, input)?;

let count = indexed_refs
Expand Down
2 changes: 1 addition & 1 deletion src/ast/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub struct ColumnSettings {
/// A default value for the column.
pub default: Option<Value>,
/// A vector of inline references associated with the column.
pub refs: Vec<refs::RefInline>,
pub refs: Vec<RefInline>,
}

/// A struct representing a table identifier.
Expand Down

0 comments on commit b9bd2aa

Please sign in to comment.