Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Georg Brandl <[email protected]>
  • Loading branch information
kngwyu and birkenfeld committed Mar 22, 2020
1 parent 9b5ea3f commit ec2b66f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pyo3-derive-backend/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl PyClassArgs {
syn::Expr::Path(exp) if exp.path.segments.len() == 1 => {
self.name = Some(exp.clone().into());
}
_ => expected!("single type path(e.g., Name)"),
_ => expected!("type name (e.g., Name)"),
},
"extends" => match &**right {
syn::Expr::Path(exp) => {
Expand All @@ -103,7 +103,7 @@ impl PyClassArgs {
};
self.has_extends = true;
}
_ => expected!("type path(e.g., my_mod::MyClass)"),
_ => expected!("type path (e.g., my_mod::MyClass)"),
},
"module" => match &**right {
syn::Expr::Lit(syn::ExprLit {
Expand All @@ -112,7 +112,7 @@ impl PyClassArgs {
}) => {
self.module = Some(lit.clone());
}
_ => expected!(r#"string literal(e.g., "mymod")"#),
_ => expected!(r#"string literal (e.g., "mymod")"#),
},
x => {
return Err(syn::Error::new_spanned(
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/invalid_pyclass_args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ error: Expected one of freelist/name/extends/module, but got extend
3 | #[pyclass(extend=pyo3::types::PyDict)]
| ^^^^^^

error: Expected type path(e.g., my_mod::MyClass), but got "PyDict"
error: Expected type path (e.g., my_mod::MyClass), but got "PyDict"
--> $DIR/invalid_pyclass_args.rs:6:21
|
6 | #[pyclass(extends = "PyDict")]
| ^^^^^^^^

error: Expected single type path(e.g., Name), but got m :: MyClass
error: Expected type name (e.g., Name), but got m :: MyClass
--> $DIR/invalid_pyclass_args.rs:9:18
|
9 | #[pyclass(name = m::MyClass)]
| ^^^^^^^^^^

error: Expected string literal(e.g., "mymod"), but got my_module
error: Expected string literal (e.g., "mymod"), but got my_module
--> $DIR/invalid_pyclass_args.rs:12:20
|
12 | #[pyclass(module = my_module)]
Expand Down

0 comments on commit ec2b66f

Please sign in to comment.