klion26 commented on code in PR #9276:
URL: https://github.com/apache/arrow-rs/pull/9276#discussion_r2782241113


##########
parquet-variant/src/path.rs:
##########
@@ -103,6 +113,12 @@ impl<'a> VariantPath<'a> {
     pub fn is_empty(&self) -> bool {
         self.0.is_empty()
     }
+
+    /// Parses a path string, panics on invalid input.
+    /// Only use for tests for known-valid input.
+    pub fn from_str_unchecked(s: &'a str) -> Self {

Review Comment:
   Thanks for the feedback. changed to `from_str_or_panic`. because clippy 
discourage to implement a `from_str` manually, and the 
`std::str::FromStr::from_str` returns `Result<Self, Self::Err>;` which is the 
same as `TryFrom`.
   
   ```
    error: method `from_str` can be confused for the standard trait method 
`std::str::FromStr::from_str
   ```



##########
parquet-variant/src/path.rs:
##########
@@ -112,9 +128,11 @@ impl<'a> From<Vec<VariantPathElement<'a>>> for 
VariantPath<'a> {
 }
 
 /// Create from &str with support for dot notation
-impl<'a> From<&'a str> for VariantPath<'a> {

Review Comment:
   Using TryFrom to return a Result allows the user to choose the appropriate 
error condition when the path can't be parsed successfully. IMHO, the new 
method makes more sense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to