mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-23 00:35:35 +00:00
Fix clippy warnings
This commit is contained in:
@ -102,10 +102,10 @@ impl Normalizer for PyNormalizer {
|
||||
#[pymethods]
|
||||
impl PyNormalizer {
|
||||
#[staticmethod]
|
||||
fn custom(obj: PyObject) -> PyResult<Self> {
|
||||
Ok(Self {
|
||||
fn custom(obj: PyObject) -> Self {
|
||||
Self {
|
||||
normalizer: PyNormalizerWrapper::Custom(CustomNormalizer::new(obj)).into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn __getstate__(&self, py: Python) -> PyResult<PyObject> {
|
||||
@ -279,10 +279,10 @@ impl PyBertNormalizer {
|
||||
handle_chinese_chars: bool,
|
||||
strip_accents: Option<bool>,
|
||||
lowercase: bool,
|
||||
) -> PyResult<(Self, PyNormalizer)> {
|
||||
) -> (Self, PyNormalizer) {
|
||||
let normalizer =
|
||||
BertNormalizer::new(clean_text, handle_chinese_chars, strip_accents, lowercase);
|
||||
Ok((PyBertNormalizer {}, normalizer.into()))
|
||||
(PyBertNormalizer {}, normalizer.into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,8 +293,8 @@ pub struct PyNFD {}
|
||||
#[pymethods]
|
||||
impl PyNFD {
|
||||
#[new]
|
||||
fn new() -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyNFD {}, PyNormalizer::new(NFD.into())))
|
||||
fn new() -> (Self, PyNormalizer) {
|
||||
(PyNFD {}, PyNormalizer::new(NFD.into()))
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,8 +305,8 @@ pub struct PyNFKD {}
|
||||
#[pymethods]
|
||||
impl PyNFKD {
|
||||
#[new]
|
||||
fn new() -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyNFKD {}, NFKD.into()))
|
||||
fn new() -> (Self, PyNormalizer) {
|
||||
(PyNFKD {}, NFKD.into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,8 +317,8 @@ pub struct PyNFC {}
|
||||
#[pymethods]
|
||||
impl PyNFC {
|
||||
#[new]
|
||||
fn new() -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyNFC {}, NFC.into()))
|
||||
fn new() -> (Self, PyNormalizer) {
|
||||
(PyNFC {}, NFC.into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,8 +329,8 @@ pub struct PyNFKC {}
|
||||
#[pymethods]
|
||||
impl PyNFKC {
|
||||
#[new]
|
||||
fn new() -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyNFKC {}, NFKC.into()))
|
||||
fn new() -> (Self, PyNormalizer) {
|
||||
(PyNFKC {}, NFKC.into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,8 +360,8 @@ impl PySequence {
|
||||
))
|
||||
}
|
||||
|
||||
fn __getnewargs__<'p>(&self, py: Python<'p>) -> PyResult<&'p PyTuple> {
|
||||
Ok(PyTuple::new(py, &[PyList::empty(py)]))
|
||||
fn __getnewargs__<'p>(&self, py: Python<'p>) -> &'p PyTuple {
|
||||
PyTuple::new(py, &[PyList::empty(py)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,8 +379,8 @@ pub struct PyLowercase {}
|
||||
#[pymethods]
|
||||
impl PyLowercase {
|
||||
#[new]
|
||||
fn new() -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyLowercase {}, Lowercase.into()))
|
||||
fn new() -> (Self, PyNormalizer) {
|
||||
(PyLowercase {}, Lowercase.into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,8 +412,8 @@ impl PyStrip {
|
||||
|
||||
#[new]
|
||||
#[args(left = "true", right = "true")]
|
||||
fn new(left: bool, right: bool) -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyStrip {}, Strip::new(left, right).into()))
|
||||
fn new(left: bool, right: bool) -> (Self, PyNormalizer) {
|
||||
(PyStrip {}, Strip::new(left, right).into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -424,8 +424,8 @@ pub struct PyStripAccents {}
|
||||
#[pymethods]
|
||||
impl PyStripAccents {
|
||||
#[new]
|
||||
fn new() -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyStripAccents {}, StripAccents.into()))
|
||||
fn new() -> (Self, PyNormalizer) {
|
||||
(PyStripAccents {}, StripAccents.into())
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,8 +436,8 @@ pub struct PyNmt {}
|
||||
#[pymethods]
|
||||
impl PyNmt {
|
||||
#[new]
|
||||
fn new() -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyNmt {}, Nmt.into()))
|
||||
fn new() -> (Self, PyNormalizer) {
|
||||
(PyNmt {}, Nmt.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user