Skip to content

Commit

Permalink
chore: more clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
iamwacko committed Sep 18, 2024
1 parent 01d5056 commit 7f0f09b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion synth/src/cli/csv/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl CsvHeader {
})
} else {
let find_index = substr
.find(|c| c == '.' || c == '[')
.find(['.', '['])
.unwrap_or(substr.len());

let key = &substr[..find_index];
Expand Down
12 changes: 5 additions & 7 deletions synth/src/cli/import_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ pub(crate) struct Collection {
/// Wrapper around `FieldContent` since we cant' impl `TryFrom` on a struct in a non-owned crate
struct FieldContentWrapper(Content);

pub(crate) fn build_namespace_import<T: DataSource + SqlxDataSource>(
pub(crate) fn build_namespace_import<T: DataSource + SqlxDataSource + Sync>(
datasource: &T,
) -> Result<Namespace>
where
T: Sync,
for<'c> &'c mut T::Connection: Executor<'c, Database = T::DB>,
String: sqlx::Type<T::DB>,
for<'d> String: sqlx::Decode<'d, T::DB> + sqlx::Encode<'d, T::DB>,
Expand Down Expand Up @@ -126,7 +125,7 @@ where
}

if let Some(primary_key) = primary_keys.first() {
let field = FieldRef::new(&format!(
let field = FieldRef::new(format!(
"{}.content.{}",
table_name, primary_key.column_name
))?;
Expand Down Expand Up @@ -185,8 +184,8 @@ where
debug!("{} foreign keys found.", foreign_keys.len());

for fk in foreign_keys {
let from_field = FieldRef::new(&format!("{}.content.{}", fk.from_table, fk.from_column))?;
let to_field = FieldRef::new(&format!("{}.content.{}", fk.to_table, fk.to_column))?;
let from_field = FieldRef::new(format!("{}.content.{}", fk.from_table, fk.from_column))?;
let to_field = FieldRef::new(format!("{}.content.{}", fk.to_table, fk.to_column))?;
let node = namespace.get_s_node_mut(&from_field)?;
*node = Content::SameAs(SameAsContent { ref_: to_field });
}
Expand All @@ -211,13 +210,12 @@ where
.collect()
}

fn populate_namespace_values<T: SqlxDataSource>(
fn populate_namespace_values<T: SqlxDataSource + Sync >(
namespace: &mut Namespace,
table_names: &[String],
datasource: &T,
) -> Result<()>
where
T: Sync,
for<'c> &'c mut T::Connection: Executor<'c, Database = T::DB>,
String: sqlx::Type<T::DB>,
for<'d> String: sqlx::Encode<'d, T::DB>,
Expand Down
1 change: 1 addition & 0 deletions synth/src/datasource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub(crate) mod mysql_datasource;
pub(crate) mod postgres_datasource;
pub(crate) mod relational_datasource;

#[allow(clippy::too_long_first_doc_paragraph)]
/// This trait encompasses all data source types, whether it's SQL or No-SQL. APIs should be defined
/// async when possible, delegating to the caller on how to handle it. Data source specific
/// implementations should be defined within the implementing struct.
Expand Down

0 comments on commit 7f0f09b

Please sign in to comment.