Skip to content

Commit b5bf939

Browse files
committed
refactor(writer): Simplify pub visibility
1 parent b8ecedc commit b5bf939

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/fmt/writer/buffer.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use std::{io, sync::Mutex};
33
use crate::fmt::writer::WriteStyle;
44

55
#[derive(Debug)]
6-
pub(in crate::fmt::writer) struct BufferWriter {
6+
pub(crate) struct BufferWriter {
77
target: WritableTarget,
88
write_style: WriteStyle,
99
}
1010

1111
impl BufferWriter {
12-
pub(in crate::fmt::writer) fn stderr(is_test: bool, write_style: WriteStyle) -> Self {
12+
pub(crate) fn stderr(is_test: bool, write_style: WriteStyle) -> Self {
1313
BufferWriter {
1414
target: if is_test {
1515
WritableTarget::PrintStderr
@@ -20,7 +20,7 @@ impl BufferWriter {
2020
}
2121
}
2222

23-
pub(in crate::fmt::writer) fn stdout(is_test: bool, write_style: WriteStyle) -> Self {
23+
pub(crate) fn stdout(is_test: bool, write_style: WriteStyle) -> Self {
2424
BufferWriter {
2525
target: if is_test {
2626
WritableTarget::PrintStdout
@@ -31,7 +31,7 @@ impl BufferWriter {
3131
}
3232
}
3333

34-
pub(in crate::fmt::writer) fn pipe(
34+
pub(crate) fn pipe(
3535
pipe: Box<Mutex<dyn io::Write + Send + 'static>>,
3636
write_style: WriteStyle,
3737
) -> Self {
@@ -41,15 +41,15 @@ impl BufferWriter {
4141
}
4242
}
4343

44-
pub(in crate::fmt::writer) fn write_style(&self) -> WriteStyle {
44+
pub(crate) fn write_style(&self) -> WriteStyle {
4545
self.write_style
4646
}
4747

48-
pub(in crate::fmt::writer) fn buffer(&self) -> Buffer {
48+
pub(crate) fn buffer(&self) -> Buffer {
4949
Buffer(Vec::new())
5050
}
5151

52-
pub(in crate::fmt::writer) fn print(&self, buf: &Buffer) -> io::Result<()> {
52+
pub(crate) fn print(&self, buf: &Buffer) -> io::Result<()> {
5353
#![allow(clippy::print_stdout)] // enabled for tests only
5454
#![allow(clippy::print_stderr)] // enabled for tests only
5555

@@ -115,23 +115,23 @@ fn adapt(buf: &[u8], write_style: WriteStyle) -> io::Result<Vec<u8>> {
115115
Ok(adapted)
116116
}
117117

118-
pub(in crate::fmt) struct Buffer(Vec<u8>);
118+
pub(crate) struct Buffer(Vec<u8>);
119119

120120
impl Buffer {
121-
pub(in crate::fmt) fn clear(&mut self) {
121+
pub(crate) fn clear(&mut self) {
122122
self.0.clear();
123123
}
124124

125-
pub(in crate::fmt) fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
125+
pub(crate) fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
126126
self.0.extend(buf);
127127
Ok(buf.len())
128128
}
129129

130-
pub(in crate::fmt) fn flush(&mut self) -> io::Result<()> {
130+
pub(crate) fn flush(&mut self) -> io::Result<()> {
131131
Ok(())
132132
}
133133

134-
pub(in crate::fmt) fn as_bytes(&self) -> &[u8] {
134+
pub(crate) fn as_bytes(&self) -> &[u8] {
135135
&self.0
136136
}
137137
}
@@ -145,7 +145,7 @@ impl std::fmt::Debug for Buffer {
145145
/// Log target, either `stdout`, `stderr` or a custom pipe.
146146
///
147147
/// Same as `Target`, except the pipe is wrapped in a mutex for interior mutability.
148-
pub(super) enum WritableTarget {
148+
pub(crate) enum WritableTarget {
149149
/// Logs will be written to standard output.
150150
WriteStdout,
151151
/// Logs will be printed to standard output.

src/fmt/writer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod target;
44
use self::buffer::BufferWriter;
55
use std::{io, mem, sync::Mutex};
66

7-
pub(super) use self::buffer::Buffer;
7+
pub(crate) use self::buffer::Buffer;
88

99
pub use target::Target;
1010

@@ -55,11 +55,11 @@ impl Writer {
5555
self.inner.write_style()
5656
}
5757

58-
pub(super) fn buffer(&self) -> Buffer {
58+
pub(crate) fn buffer(&self) -> Buffer {
5959
self.inner.buffer()
6060
}
6161

62-
pub(super) fn print(&self, buf: &Buffer) -> io::Result<()> {
62+
pub(crate) fn print(&self, buf: &Buffer) -> io::Result<()> {
6363
self.inner.print(buf)
6464
}
6565
}

0 commit comments

Comments
 (0)