Ensures that a parsed expression is a valid Rust module-like path and the path contains valid segments. # Example ```rust let expression: syn::Result = syn::parse_str("std::mem::replace"); assert!(expression.is_ok()); let exp_path = expression.unwrap(); let is_path = match exp_path { syn::Expr::Path(path_expression) if !path_expression.path.segments.is_empty() => Some(path_expression),
(expr: Expr)
| 42 | /// assert_eq!(path.path.segments.len(), 3); |
| 43 | /// ``` |
| 44 | fn check_expression_is_path(expr: Expr) -> Option<ExprPath> { |
| 45 | match expr { |
| 46 | Expr::Path(expr_path) if !expr_path.path.segments.is_empty() => Some(expr_path), |
| 47 | _ => None, |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | fn check_token(token: proc_macro2::TokenTree, arg: &str) -> Option<String> { |
| 52 | // this detects the '(...)' part in #[serde(rename_all = "UPPERCASE", tag = "type")] |
nothing calls this directly
no outgoing calls
no test coverage detected