Error when using the tab-size option (#12006)

This commit is contained in:
Micha Reiser 2024-06-25 09:36:04 +02:00
parent 36a9efdb48
commit 9e8a45f343
3 changed files with 12 additions and 20 deletions

View file

@ -421,13 +421,13 @@ impl Configuration {
};
#[allow(deprecated)]
let indent_width = {
if options.tab_size.is_some() {
warn_user_once!("The `tab-size` option has been renamed to `indent-width` to emphasize that it configures the indentation used by the formatter as well as the tab width. Please update your configuration to use `indent-width = <value>` instead.");
}
options.indent_width.or(options.tab_size)
};
if options.tab_size.is_some() {
let config_to_update = path.map_or_else(
|| String::from("your `--config` CLI arguments"),
|path| format!("`{}`", fs::relativize_path(path)),
);
return Err(anyhow!("The `tab-size` option has been renamed to `indent-width` to emphasize that it configures the indentation used by the formatter as well as the tab width. Please update {config_to_update} to use `indent-width = <value>` instead."));
}
let output_format = {
options
@ -508,7 +508,7 @@ impl Configuration {
output_format,
force_exclude: options.force_exclude,
line_length: options.line_length,
indent_width,
indent_width: options.indent_width,
namespace_packages: options
.namespace_packages
.map(|namespace_package| resolve_src(&namespace_package, project_root))