mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +00:00
Error on zero tab width (#6429)
## Summary Error if `tab-size` is set to zero (it is used as a divisor). Closes #6423. Also fixes a typo. ## Test Plan Running ruff with a config ```toml [tool.ruff] tab-size = 0 ``` returns an error message to the user saying that `tab-size` must be greater than zero.
This commit is contained in:
parent
55d6fd53cd
commit
1b9fed8397
6 changed files with 27 additions and 19 deletions
|
@ -2,6 +2,7 @@ use std::borrow::Cow;
|
|||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::num::NonZeroU8;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
@ -205,6 +206,13 @@ impl CacheKey for i8 {
|
|||
}
|
||||
}
|
||||
|
||||
impl CacheKey for NonZeroU8 {
|
||||
#[inline]
|
||||
fn cache_key(&self, state: &mut CacheKeyHasher) {
|
||||
state.write_u8(self.get());
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_cache_key_tuple {
|
||||
() => (
|
||||
impl CacheKey for () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue