mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
Adapt is-macro for a few enums (#3182)
This commit is contained in:
parent
0f37a98d91
commit
da98fab4ae
16 changed files with 110 additions and 125 deletions
|
@ -41,23 +41,22 @@ pub fn run(
|
|||
|
||||
// Initialize the cache.
|
||||
if cache.into() {
|
||||
fn init_cache(path: &std::path::Path) {
|
||||
if let Err(e) = cache::init(path) {
|
||||
error!(
|
||||
"Failed to initialize cache at {}: {e:?}",
|
||||
path.to_string_lossy()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
match &pyproject_strategy {
|
||||
PyprojectDiscovery::Fixed(settings) => {
|
||||
if let Err(e) = cache::init(&settings.cli.cache_dir) {
|
||||
error!(
|
||||
"Failed to initialize cache at {}: {e:?}",
|
||||
settings.cli.cache_dir.to_string_lossy()
|
||||
);
|
||||
}
|
||||
init_cache(&settings.cli.cache_dir);
|
||||
}
|
||||
PyprojectDiscovery::Hierarchical(default) => {
|
||||
for settings in std::iter::once(default).chain(resolver.iter()) {
|
||||
if let Err(e) = cache::init(&settings.cli.cache_dir) {
|
||||
error!(
|
||||
"Failed to initialize cache at {}: {e:?}",
|
||||
settings.cli.cache_dir.to_string_lossy()
|
||||
);
|
||||
}
|
||||
init_cache(&settings.cli.cache_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,7 @@ pub fn run_stdin(
|
|||
return Ok(Diagnostics::default());
|
||||
}
|
||||
}
|
||||
let settings = match pyproject_strategy {
|
||||
PyprojectDiscovery::Fixed(settings) => settings,
|
||||
PyprojectDiscovery::Hierarchical(settings) => settings,
|
||||
};
|
||||
let settings = pyproject_strategy.top_level_settings();
|
||||
let package_root = filename
|
||||
.and_then(Path::parent)
|
||||
.and_then(|path| packaging::detect_package_root(path, &settings.lib.namespace_packages));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue