Skip to content

Commit

Permalink
Merge pull request #4409 from hamirmahal/style/simplify-some-statemen…
Browse files Browse the repository at this point in the history
…ts-for-readability

style: simplify some statements for readability
  • Loading branch information
Ten0 authored Dec 27, 2024
2 parents e0400b1 + 8ff6c04 commit 3f69aa4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
3 changes: 1 addition & 2 deletions diesel_derives/src/deprecated/belongs_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ pub fn parse_belongs_to(name: Ident, input: ParseStream) -> Result<BelongsTo> {
name.span(),
format!(
"unexpected end of input, expected parentheses\n\
help: The correct format looks like `#[diesel({})]`",
BELONGS_TO_NOTE
help: The correct format looks like `#[diesel({BELONGS_TO_NOTE})]`"
),
));
}
Expand Down
3 changes: 1 addition & 2 deletions diesel_derives/src/deprecated/postgres_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ pub fn parse_postgres_type(name: Ident, input: ParseStream) -> Result<PostgresTy
name.span(),
format!(
"unexpected end of input, expected parentheses\n\
help: The correct format looks like `#[diesel({})]`",
POSTGRES_TYPE_NOTE
help: The correct format looks like `#[diesel({POSTGRES_TYPE_NOTE})]`"
),
));
}
Expand Down
3 changes: 1 addition & 2 deletions diesel_derives/src/parsers/mysql_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ impl Parse for MysqlType {
input.span(),
format!(
"expected attribute `name`\n\
help: The correct format looks like #[diesel({})]",
MYSQL_TYPE_NOTE
help: The correct format looks like #[diesel({MYSQL_TYPE_NOTE})]"
),
))
}
Expand Down
3 changes: 1 addition & 2 deletions diesel_derives/src/parsers/sqlite_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ impl Parse for SqliteType {
input.span(),
format!(
"expected attribute `name`\n\
help: The correct format looks like #[diesel({})]",
SQLITE_TYPE_NOTE
help: The correct format looks like #[diesel({SQLITE_TYPE_NOTE})]"
),
))
}
Expand Down
7 changes: 2 additions & 5 deletions diesel_migrations/migrations_macros/src/embed_migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ pub fn expand(path: String) -> proc_macro2::TokenStream {
};
let migrations_expr = migration_directory_from_given_path(migrations_path_opt.as_deref())
.unwrap_or_else(|_| {
panic!(
"Failed to receive migrations dir from {:?}",
migrations_path_opt
)
panic!("Failed to receive migrations dir from {migrations_path_opt:?}")
});
let embedded_migrations =
migration_literals_from_path(&migrations_expr).expect("Failed to read migration literals");
Expand All @@ -42,7 +39,7 @@ fn migration_literals_from_path(
fn migration_literal_from_path(path: &Path) -> proc_macro2::TokenStream {
let name = path
.file_name()
.unwrap_or_else(|| panic!("Can't get file name from path `{:?}`", path))
.unwrap_or_else(|| panic!("Can't get file name from path `{path:?}`"))
.to_string_lossy();
if version_from_string(&name).is_none() {
panic!(
Expand Down

0 comments on commit 3f69aa4

Please sign in to comment.