Skip to content

Commit c8cebdd

Browse files
committed
cargo fmt
1 parent 700903d commit c8cebdd

12 files changed

Lines changed: 92 additions & 20 deletions

File tree

‎crates/stdlib/src/json/machinery.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ fn json_escaped_char(c: u8) -> Option<&'static str> {
7272
}
7373
}
7474

75-
pub(super) fn write_json_string<W: io::Write>(wtf8: &Wtf8, ascii_only: bool, w: &mut W) -> io::Result<()> {
75+
pub(super) fn write_json_string<W: io::Write>(
76+
wtf8: &Wtf8,
77+
ascii_only: bool,
78+
w: &mut W,
79+
) -> io::Result<()> {
7680
w.write_all(b"\"")?;
7781
let mut write_start_idx = 0;
7882
let bytes = wtf8.as_bytes();

‎crates/stdlib/src/ssl/cert.rs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ mod cert_error {
125125
}
126126

127127
/// Convert error message to rustls::Error with InvalidCertificate wrapper and custom ErrorKind
128-
pub(super) fn to_rustls_cert_error(kind: io::ErrorKind, msg: impl Into<String>) -> rustls::Error {
128+
pub(super) fn to_rustls_cert_error(
129+
kind: io::ErrorKind,
130+
msg: impl Into<String>,
131+
) -> rustls::Error {
129132
rustls::Error::InvalidCertificate(rustls::CertificateError::Other(rustls::OtherError(
130133
Arc::new(io::Error::new(kind, msg.into())),
131134
)))
@@ -367,7 +370,10 @@ pub(super) fn cert_to_dict(
367370
///
368371
/// Similar to cert_to_dict but includes additional fields like crlDistributionPoints
369372
/// and uses CPython's specific ordering: issuer, notAfter, notBefore, serialNumber, subject, version
370-
pub(super) fn cert_der_to_dict_helper(vm: &VirtualMachine, cert_der: &[u8]) -> PyResult<PyObjectRef> {
373+
pub(super) fn cert_der_to_dict_helper(
374+
vm: &VirtualMachine,
375+
cert_der: &[u8],
376+
) -> PyResult<PyObjectRef> {
371377
// Parse the certificate using x509-parser
372378
let (_, cert) = x509_parser::parse_x509_certificate(cert_der)
373379
.map_err(|e| vm.new_value_error(format!("Failed to parse certificate: {e}")))?;

‎crates/stdlib/src/ssl/compat.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,9 @@ impl TlsConnection {
369369
}
370370

371371
/// Get peer certificates
372-
pub(super) fn peer_certificates(&self) -> Option<&[rustls::pki_types::CertificateDer<'static>]> {
372+
pub(super) fn peer_certificates(
373+
&self,
374+
) -> Option<&[rustls::pki_types::CertificateDer<'static>]> {
373375
match self {
374376
TlsConnection::Client(conn) => conn.peer_certificates(),
375377
TlsConnection::Server(conn) => conn.peer_certificates(),

‎crates/vm/src/anystr.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ fn saturate_to_isize(py_int: PyIntRef) -> isize {
8888
}
8989

9090
// help get optional string indices
91-
pub(crate) fn adjust_indices(start: Option<PyIntRef>, end: Option<PyIntRef>, len: usize) -> Range<usize> {
91+
pub(crate) fn adjust_indices(
92+
start: Option<PyIntRef>,
93+
end: Option<PyIntRef>,
94+
len: usize,
95+
) -> Range<usize> {
9296
let mut start = start.map_or(0, saturate_to_isize);
9397
let mut end = end.map_or(len as isize, saturate_to_isize);
9498
if end > len as isize {

‎crates/vm/src/builtins/descriptor.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ pub enum MemberKind {
177177
ObjectEx = 16,
178178
}
179179

180-
pub(crate) type MemberSetterFunc = Option<fn(&VirtualMachine, PyObjectRef, PySetterValue) -> PyResult<()>>;
180+
pub(crate) type MemberSetterFunc =
181+
Option<fn(&VirtualMachine, PyObjectRef, PySetterValue) -> PyResult<()>>;
181182

182183
pub enum MemberGetter {
183184
Getter(fn(&VirtualMachine, PyObjectRef) -> PyResult),

‎crates/vm/src/dict_inner.rs‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,23 @@ impl<T: Clone> Dict<T> {
324324
Ok(())
325325
}
326326

327-
pub(crate) fn contains<K: DictKey + ?Sized>(&self, vm: &VirtualMachine, key: &K) -> PyResult<bool> {
327+
pub(crate) fn contains<K: DictKey + ?Sized>(
328+
&self,
329+
vm: &VirtualMachine,
330+
key: &K,
331+
) -> PyResult<bool> {
328332
let key_hash = key.key_hash(vm)?;
329333
let (entry, _) = self.lookup(vm, key, key_hash, None)?;
330334
Ok(entry.index().is_some())
331335
}
332336

333337
/// Retrieve a key
334338
#[cfg_attr(feature = "flame-it", flame("Dict"))]
335-
pub(crate) fn get<K: DictKey + ?Sized>(&self, vm: &VirtualMachine, key: &K) -> PyResult<Option<T>> {
339+
pub(crate) fn get<K: DictKey + ?Sized>(
340+
&self,
341+
vm: &VirtualMachine,
342+
key: &K,
343+
) -> PyResult<Option<T>> {
336344
let hash = key.key_hash(vm)?;
337345
self._get_inner(vm, key, hash)
338346
}
@@ -488,7 +496,12 @@ impl<T: Clone> Dict<T> {
488496
Ok(removed.map(|entry| entry.value))
489497
}
490498

491-
pub(crate) fn delete_or_insert(&self, vm: &VirtualMachine, key: &PyObject, value: T) -> PyResult<()> {
499+
pub(crate) fn delete_or_insert(
500+
&self,
501+
vm: &VirtualMachine,
502+
key: &PyObject,
503+
value: T,
504+
) -> PyResult<()> {
492505
let hash = key.key_hash(vm)?;
493506
let _removed = loop {
494507
let lookup = self.lookup(vm, key, hash, None)?;
@@ -771,7 +784,11 @@ impl<T: Clone> Dict<T> {
771784
}
772785

773786
/// Retrieve and delete a key
774-
pub(crate) fn pop<K: DictKey + ?Sized>(&self, vm: &VirtualMachine, key: &K) -> PyResult<Option<T>> {
787+
pub(crate) fn pop<K: DictKey + ?Sized>(
788+
&self,
789+
vm: &VirtualMachine,
790+
key: &K,
791+
) -> PyResult<Option<T>> {
775792
let hash_value = key.key_hash(vm)?;
776793
let removed = loop {
777794
let lookup = self.lookup(vm, key, hash_value, None)?;

‎crates/vm/src/stdlib/_ctypes.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,11 @@ pub(crate) mod _ctypes {
768768
}
769769

770770
#[pyfunction]
771-
pub(crate) fn byref(obj: PyObjectRef, offset: OptionalArg<isize>, vm: &VirtualMachine) -> PyResult {
771+
pub(crate) fn byref(
772+
obj: PyObjectRef,
773+
offset: OptionalArg<isize>,
774+
vm: &VirtualMachine,
775+
) -> PyResult {
772776
use super::FfiArgValue;
773777

774778
// Check if obj is a ctypes instance

‎crates/vm/src/stdlib/_ctypes/base.rs‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,12 @@ impl PyCData {
785785
///
786786
/// If this object has a base (is embedded in another structure/union/array),
787787
/// the reference is stored in the root object's b_objects with a hierarchical key.
788-
pub(crate) fn keep_ref(&self, index: usize, keep: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
788+
pub(crate) fn keep_ref(
789+
&self,
790+
index: usize,
791+
keep: PyObjectRef,
792+
vm: &VirtualMachine,
793+
) -> PyResult<()> {
789794
// Optimization: no need to store None
790795
if vm.is_none(&keep) {
791796
return Ok(());
@@ -1401,7 +1406,11 @@ impl PyCField {
14011406

14021407
/// Create a new CField from an existing field with adjusted offset and index
14031408
/// Used by MakeFields to promote anonymous fields
1404-
pub(crate) fn new_from_field(fdescr: &PyCField, index_offset: usize, offset_delta: isize) -> Self {
1409+
pub(crate) fn new_from_field(
1410+
fdescr: &PyCField,
1411+
index_offset: usize,
1412+
offset_delta: isize,
1413+
) -> Self {
14051414
Self {
14061415
name: fdescr.name.clone(),
14071416
offset: fdescr.offset + offset_delta,

‎crates/vm/src/stdlib/_io.rs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ mod _io {
193193
result.map(Some)
194194
}
195195

196-
pub(super) fn new_unsupported_operation(vm: &VirtualMachine, msg: String) -> PyBaseExceptionRef {
196+
pub(super) fn new_unsupported_operation(
197+
vm: &VirtualMachine,
198+
msg: String,
199+
) -> PyBaseExceptionRef {
197200
vm.new_os_subtype_error(unsupported_operation().to_owned(), None, msg)
198201
.upcast()
199202
}
@@ -1536,7 +1539,10 @@ mod _io {
15361539
})
15371540
}
15381541

1539-
pub(super) fn repr_file_obj_name(obj: &PyObject, vm: &VirtualMachine) -> PyResult<Option<PyStrRef>> {
1542+
pub(super) fn repr_file_obj_name(
1543+
obj: &PyObject,
1544+
vm: &VirtualMachine,
1545+
) -> PyResult<Option<PyStrRef>> {
15401546
let name = match obj.get_attr("name", vm) {
15411547
Ok(name) => Some(name),
15421548
Err(e)

‎crates/vm/src/stdlib/_signal.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ pub(crate) mod _signal {
8888
#[cfg(any(target_os = "linux", target_os = "android"))]
8989
mod ffi {
9090
unsafe extern "C" {
91-
pub(super) fn getitimer(which: libc::c_int, curr_value: *mut libc::itimerval) -> libc::c_int;
91+
pub(super) fn getitimer(
92+
which: libc::c_int,
93+
curr_value: *mut libc::itimerval,
94+
) -> libc::c_int;
9295
pub(super) fn setitimer(
9396
which: libc::c_int,
9497
new_value: *const libc::itimerval,

0 commit comments

Comments
 (0)