Skip to content

Commit 7eed4a1

Browse files
committed
Fix Clippy 0.1.95 warnings
Backport of: #13108
1 parent b353bbb commit 7eed4a1

5 files changed

Lines changed: 9 additions & 25 deletions

File tree

‎pydantic-core/src/input/input_abstract.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub type ValMatch<T> = ValResult<ValidationMatch<T>>;
5656
/// the convention is to either implement:
5757
/// * `strict_*` & `lax_*` if they have different behavior
5858
/// * or, `validate_*` and `strict_*` to just call `validate_*` if the behavior for strict and lax is the same
59-
pub trait Input<'py>: fmt::Debug {
59+
pub(crate) trait Input<'py>: fmt::Debug {
6060
fn py_converter(&self) -> impl IntoPyObject<'py> + '_;
6161

6262
#[inline]
@@ -188,7 +188,7 @@ pub trait Input<'py>: fmt::Debug {
188188
/// this trait we abstract over whether the return value from the iterator is owned
189189
/// or borrowed; all we care about is that we can borrow it again with `borrow_input`
190190
/// for some lifetime 'a.
191-
pub trait BorrowInput<'py> {
191+
pub(crate) trait BorrowInput<'py> {
192192
type Input: Input<'py> + ?Sized;
193193
fn borrow_input(&self) -> &Self::Input;
194194
}
@@ -237,7 +237,7 @@ pub trait ConsumeIterator<T> {
237237
}
238238

239239
/// For validations from a dictionary
240-
pub trait ValidatedDict<'py> {
240+
pub(crate) trait ValidatedDict<'py> {
241241
type Key<'a>: BorrowInput<'py> + Clone + Into<LocItem>
242242
where
243243
Self: 'a;

‎pydantic-core/src/input/input_python.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,15 +753,15 @@ fn maybe_as_enum<'py>(v: &Bound<'py, PyAny>) -> Option<Bound<'py, PyAny>> {
753753
}
754754

755755
#[cfg_attr(debug_assertions, derive(Debug))]
756-
pub struct PyArgs<'py> {
756+
pub(crate) struct PyArgs<'py> {
757757
pub args: Option<PyPosArgs<'py>>,
758758
pub kwargs: Option<PyKwargs<'py>>,
759759
}
760760

761761
#[cfg_attr(debug_assertions, derive(Debug))]
762762
pub struct PyPosArgs<'py>(Bound<'py, PyTuple>);
763763
#[cfg_attr(debug_assertions, derive(Debug))]
764-
pub struct PyKwargs<'py>(Bound<'py, PyDict>);
764+
pub(crate) struct PyKwargs<'py>(Bound<'py, PyDict>);
765765

766766
impl<'py> PyArgs<'py> {
767767
pub fn new(args: Option<Bound<'py, PyTuple>>, kwargs: Option<Bound<'py, PyDict>>) -> Self {

‎pydantic-core/src/input/input_string.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use super::{
2323
};
2424

2525
#[derive(Debug, Clone, IntoPyObject, IntoPyObjectRef)]
26-
pub enum StringMapping<'py> {
26+
pub(crate) enum StringMapping<'py> {
2727
String(Bound<'py, PyString>),
2828
Mapping(Bound<'py, PyDict>),
2929
}
@@ -265,7 +265,7 @@ impl<'py> BorrowInput<'py> for StringMapping<'py> {
265265
}
266266
}
267267

268-
pub struct StringMappingDict<'py>(Bound<'py, PyDict>);
268+
pub(crate) struct StringMappingDict<'py>(Bound<'py, PyDict>);
269269

270270
impl<'py> Arguments<'py> for StringMappingDict<'py> {
271271
type Args = Never;

‎pydantic-core/src/input/return_enums.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ impl EitherBytes<'_, '_> {
558558
#[derive(IntoPyObject)]
559559
pub enum EitherInt<'py> {
560560
I64(i64),
561+
#[expect(dead_code, reason = "Should this variant be used?")]
561562
U64(u64),
562563
BigInt(BigInt),
563564
Py(Bound<'py, PyAny>),

‎pydantic-core/src/validators/mod.rs‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl PySome {
8787
#[pymethods]
8888
impl PySome {
8989
pub fn __repr__(&self, py: Python) -> PyResult<String> {
90-
Ok(format!("Some({})", self.value.bind(py).repr()?,))
90+
Ok(format!("Some({})", self.value.bind(py).repr()?))
9191
}
9292

9393
#[new]
@@ -731,23 +731,6 @@ impl<'a, 'py> Extra<'a, 'py> {
731731
}
732732
}
733733

734-
impl Extra<'_, '_> {
735-
pub fn as_strict(&self) -> Self {
736-
Self {
737-
input_type: self.input_type,
738-
data: self.data.clone(),
739-
strict: Some(true),
740-
extra_behavior: self.extra_behavior,
741-
from_attributes: self.from_attributes,
742-
context: self.context,
743-
self_instance: self.self_instance,
744-
cache_str: self.cache_str,
745-
by_alias: self.by_alias,
746-
by_name: self.by_name,
747-
}
748-
}
749-
}
750-
751734
#[derive(Debug)]
752735
#[enum_dispatch(PyGcTraverse)]
753736
pub enum CombinedValidator {

0 commit comments

Comments
 (0)