File tree 1 file changed +11
-1
lines changed
crates/ruff_workspace/src
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -201,9 +201,19 @@ pub(super) fn load_options<P: AsRef<Path>>(
201
201
/// if the file exists and has `requires-python`.
202
202
fn get_fallback_target_version ( dir : & Path ) -> Option < PythonVersion > {
203
203
let pyproject_path = dir. join ( "pyproject.toml" ) ;
204
- let Ok ( pyproject ) = parse_pyproject_toml ( pyproject_path ) else {
204
+ if !pyproject_path . exists ( ) {
205
205
return None ;
206
+ }
207
+ let parsed_pyproject = parse_pyproject_toml ( & pyproject_path) ;
208
+
209
+ let pyproject = match parsed_pyproject {
210
+ Ok ( pyproject) => pyproject,
211
+ Err ( err) => {
212
+ debug ! ( "Failed to find fallback `target-version` due to: {}" , err) ;
213
+ return None ;
214
+ }
206
215
} ;
216
+
207
217
if let Some ( project) = pyproject. project {
208
218
if let Some ( requires_python) = project. requires_python {
209
219
return get_minimum_supported_version ( & requires_python) ;
You can’t perform that action at this time.
0 commit comments