mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-04-01 17:45:35 +00:00
apply clippy
This commit is contained in:
parent
0717e473b7
commit
68e7894125
3 changed files with 9 additions and 5 deletions
|
|
@ -18,7 +18,7 @@ impl Default {
|
|||
if !buffer.starts_with(CODE) {
|
||||
return Err(Error::Code);
|
||||
}
|
||||
let header = Header::parse(buffer).map_err(|e| Error::Header(e))?;
|
||||
let header = Header::parse(buffer).map_err(Error::Header)?;
|
||||
Ok(Self {
|
||||
content: buffer.get(header.len() + 1..).map(|v| v.to_vec()),
|
||||
header,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ impl Header {
|
|||
}
|
||||
Ok(Self(
|
||||
crate::client::connection::response::header_bytes(buffer)
|
||||
.map_err(|e| Error::Header(e))?
|
||||
.map_err(Error::Header)?
|
||||
.to_vec(),
|
||||
))
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ impl Header {
|
|||
pub fn mime(&self) -> Result<String, Error> {
|
||||
glib::Regex::split_simple(
|
||||
r"^\d{2}\s([^\/]+\/[^\s;]+)",
|
||||
std::str::from_utf8(&self.0).map_err(|e| Error::Utf8Error(e))?,
|
||||
std::str::from_utf8(&self.0).map_err(Error::Utf8Error)?,
|
||||
glib::RegexCompileFlags::DEFAULT,
|
||||
glib::RegexMatchFlags::DEFAULT,
|
||||
)
|
||||
|
|
@ -37,6 +37,10 @@ impl Header {
|
|||
self.0.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.0.is_empty()
|
||||
}
|
||||
|
||||
pub fn as_bytes(&self) -> &[u8] {
|
||||
&self.0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue