Skip to content

Commit

Permalink
refactor: make RefMutGuard import more local
Browse files Browse the repository at this point in the history
  • Loading branch information
sftse committed Oct 23, 2024
1 parent 85a64f8 commit 5fa5dda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions bindings/python/src/utils/normalization.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::regex::PyRegex;
use super::{DestroyPtr, RefMutContainer, RefMutGuard};
use super::{DestroyPtr, RefMutContainer};
use crate::error::ToPyResult;
use pyo3::exceptions;
use pyo3::prelude::*;
Expand Down Expand Up @@ -396,8 +396,8 @@ impl DestroyPtr for PyNormalizedStringRefMut {
}

impl PyNormalizedStringRefMut {
pub fn new(normalized: &mut NormalizedString) -> RefMutGuard<'_, Self> {
RefMutGuard::new(Self {
pub fn new(normalized: &mut NormalizedString) -> super::RefMutGuard<'_, Self> {
super::RefMutGuard::new(Self {
inner: RefMutContainer::new(normalized),
})
}
Expand Down
8 changes: 3 additions & 5 deletions bindings/python/src/utils/pretokenization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;

use super::{
DestroyPtr, PyNormalizedString, PyNormalizedStringRefMut, RefMutContainer, RefMutGuard,
};
use super::{DestroyPtr, PyNormalizedString, PyNormalizedStringRefMut, RefMutContainer};
use crate::encoding::PyEncoding;
use crate::error::ToPyResult;
use crate::token::PyToken;
Expand Down Expand Up @@ -272,10 +270,10 @@ impl DestroyPtr for PyPreTokenizedStringRefMut {
}

impl PyPreTokenizedStringRefMut {
pub fn new(pretok: &mut tk::PreTokenizedString) -> RefMutGuard<'_, Self> {
pub fn new(pretok: &mut tk::PreTokenizedString) -> super::RefMutGuard<'_, Self> {
// SAFETY: This is safe because we return a RefMutGuard here.
// The compiler will make sure the &mut stays valid as necessary.
RefMutGuard::new(Self {
super::RefMutGuard::new(Self {
inner: RefMutContainer::new(pretok),
})
}
Expand Down

0 comments on commit 5fa5dda

Please sign in to comment.