fix: eliminate `unwrap`s

This commit is contained in:
Shunsuke Shibayama 2024-11-23 19:41:10 +09:00
parent 9a9215ef58
commit a0d713b2d2
2 changed files with 2 additions and 2 deletions

View File

@ -3163,7 +3163,7 @@ impl ASTConverter {
if path.ends_with("__init__.py") {
path.pop();
}
let mod_name = path.file_name().unwrap();
let mod_name = path.file_name().unwrap_or_default();
if name.name.as_str() == mod_name.to_string_lossy().trim_end_matches(".py") {
let sym = format!("{module}/{}", name.name);
let mod_name = Expr::Literal(Literal::new(quoted_symbol(

View File

@ -100,7 +100,7 @@ impl SimplePythonParser {
// let mut locator = LinearLocator::new(&py_code);
let err = locator.locate_error::<_, ParseErrorType>(err);
let msg = err.to_string();
let loc = err.location.unwrap();
let loc = err.location.unwrap_or_default();
let core = ErrorCore::new(
vec![],
msg,