Skip to content

Commit d3bc0f3

Browse files
authored
Merge branch 'main' into aleksandr.pasechnik/svls-6242-fips-features-for-bottlecap
2 parents 6b64148 + 7f595c0 commit d3bc0f3

File tree

8 files changed

+22
-46
lines changed

8 files changed

+22
-46
lines changed

ipc/src/platform/channel/metadata.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ impl HandlesTransport for &mut ChannelMetadata {
2525
let handle = hint.as_raw_fd();
2626
#[cfg(windows)]
2727
let handle = hint.as_raw_handle();
28-
io::Error::new(
29-
io::ErrorKind::Other,
30-
format!("can't provide expected handle for hint: {:?}", handle),
31-
)
28+
io::Error::other(format!(
29+
"can't provide expected handle for hint: {handle:?}"
30+
))
3231
})
3332
}
3433
}

ipc/src/platform/platform_handle.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ impl<T> PlatformHandle<T> {
6363
pub(crate) fn as_owned_fd(&self) -> io::Result<&Arc<OwnedFileHandle>> {
6464
match &self.inner {
6565
Some(fd) => Ok(fd),
66-
None => Err(io::Error::new(
67-
io::ErrorKind::Other,
68-
"attempting to unwrap FD from invalid handle".to_string(),
66+
None => Err(io::Error::other(
67+
"attempting to unwrap FD from invalid handle",
6968
)),
7069
}
7170
}
@@ -83,19 +82,14 @@ impl<T> PlatformHandle<T> {
8382
let shared_handle = match self.inner {
8483
Some(shared_handle) => shared_handle,
8584
None => {
86-
return Err(io::Error::new(
87-
io::ErrorKind::Other,
88-
"attempting to unwrap FD from invalid handle".to_string(),
85+
return Err(io::Error::other(
86+
"attempting to unwrap FD from invalid handle",
8987
))
9088
}
9189
};
9290

93-
Arc::try_unwrap(shared_handle).map_err(|_| {
94-
io::Error::new(
95-
io::ErrorKind::Other,
96-
"attempting to unwrap FD from shared platform handle".to_string(),
97-
)
98-
})
91+
Arc::try_unwrap(shared_handle)
92+
.map_err(|_| io::Error::other("attempting to unwrap FD from shared platform handle"))
9993
}
10094

10195
/// casts the associated type

ipc/src/transport/blocking.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ where
104104
}
105105
}
106106
}
107-
Err(io::Error::new(
108-
io::ErrorKind::Other,
109-
"couldn't read entire item",
110-
))
107+
Err(io::Error::other("couldn't read entire item"))
111108
}
112109

113110
fn do_send(&mut self, req: OutgoingItem) -> Result<(), io::Error> {
@@ -192,10 +189,7 @@ where
192189
return resp.message.map_err(|e| io::Error::new(e.kind, e.detail));
193190
}
194191
}
195-
Err(io::Error::new(
196-
io::ErrorKind::Other,
197-
"Request is without a response",
198-
))
192+
Err(io::Error::other("Request is without a response"))
199193
}
200194
}
201195

ipc/src/transport/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ where
7676
Some(Err(e)) => Some(Err(e.into())),
7777
None => None,
7878
})
79-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
79+
.map_err(io::Error::other)
8080
}
8181
}
8282

@@ -92,7 +92,7 @@ where
9292
self.project()
9393
.inner
9494
.poll_ready(cx)
95-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
95+
.map_err(io::Error::other)
9696
}
9797

9898
fn start_send(self: Pin<&mut Self>, item: SinkItem) -> io::Result<()> {
@@ -101,23 +101,21 @@ where
101101
let mut message = this.channel_metadata.lock().unwrap();
102102
let message = message.create_message(item)?;
103103

104-
this.inner
105-
.start_send(message)
106-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
104+
this.inner.start_send(message).map_err(io::Error::other)
107105
}
108106

109107
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
110108
self.project()
111109
.inner
112110
.poll_flush(cx)
113-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
111+
.map_err(io::Error::other)
114112
}
115113

116114
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
117115
self.project()
118116
.inner
119117
.poll_close(cx)
120-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
118+
.map_err(io::Error::other)
121119
}
122120
}
123121

profiling-ffi/src/profiles/datatypes.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,6 @@ mod tests {
835835
#[test]
836836
// TODO FIX
837837
#[cfg_attr(miri, ignore)]
838-
839838
fn aggregate_samples() -> anyhow::Result<()> {
840839
unsafe {
841840
let sample_type: *const ValueType = &ValueType::new("samples", "count");

sidecar/src/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ pub fn daemonize(listener: IpcServer, mut cfg: Config) -> anyhow::Result<()> {
203203
spawn_cfg
204204
.shared_lib_dependencies(lib_deps)
205205
.wait_spawn()
206-
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
206+
.map_err(io::Error::other)
207207
.context("Could not spawn the sidecar daemon")?;
208208

209209
Ok(())

sidecar/src/service/blocking.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ impl SidecarTransport {
5858
pub fn set_read_timeout(&mut self, timeout: Option<Duration>) -> io::Result<()> {
5959
match self.inner.lock() {
6060
Ok(mut t) => t.set_read_timeout(timeout),
61-
Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
61+
Err(e) => Err(io::Error::other(e.to_string())),
6262
}
6363
}
6464

6565
pub fn set_write_timeout(&mut self, timeout: Option<Duration>) -> io::Result<()> {
6666
match self.inner.lock() {
6767
Ok(mut t) => t.set_write_timeout(timeout),
68-
Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
68+
Err(e) => Err(io::Error::other(e.to_string())),
6969
}
7070
}
7171

@@ -81,14 +81,14 @@ impl SidecarTransport {
8181
pub fn send(&mut self, item: SidecarInterfaceRequest) -> io::Result<()> {
8282
match self.inner.lock() {
8383
Ok(mut t) => t.send(item),
84-
Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
84+
Err(e) => Err(io::Error::other(e.to_string())),
8585
}
8686
}
8787

8888
pub fn call(&mut self, item: SidecarInterfaceRequest) -> io::Result<SidecarInterfaceResponse> {
8989
match self.inner.lock() {
9090
Ok(mut t) => t.call(item),
91-
Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
91+
Err(e) => Err(io::Error::other(e.to_string())),
9292
}
9393
}
9494
}

tinybytes/src/bytes_string.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use serde::ser::{Serialize, Serializer};
77
use std::fmt::{Debug, Formatter};
88
use std::{borrow::Borrow, hash, str::Utf8Error};
99

10-
#[derive(Clone, Eq, PartialEq)]
10+
#[derive(Clone, Default, Eq, PartialEq)]
1111
pub struct BytesString {
1212
bytes: Bytes,
1313
}
@@ -141,14 +141,6 @@ impl BytesString {
141141
}
142142
}
143143

144-
impl Default for BytesString {
145-
fn default() -> Self {
146-
Self {
147-
bytes: Bytes::empty(),
148-
}
149-
}
150-
}
151-
152144
impl Borrow<str> for BytesString {
153145
fn borrow(&self) -> &str {
154146
self.as_str()

0 commit comments

Comments
 (0)