Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ impl<R: Read> StripHeaderReader<R> {
if byte == b'\n' {
HeaderState::PastHeader
} else {
fail!(io::Error::new(
Err(io::Error::new(
io::ErrorKind::InvalidData,
"expected newline"
));
"expected newline",
))?
}
}
HeaderState::PastHeader => {
Expand All @@ -108,10 +108,10 @@ pub fn strip_junk_header(slice: &[u8]) -> io::Result<&[u8]> {
let mut need_newline = false;
for (idx, &byte) in slice.iter().enumerate() {
if need_newline && byte != b'\n' {
fail!(io::Error::new(
Err(io::Error::new(
io::ErrorKind::InvalidData,
"expected newline"
));
"expected newline",
))?
} else if is_junk_json(byte) {
continue;
} else if byte == b'\r' {
Expand All @@ -136,7 +136,7 @@ fn decode_rmi(rmi_str: &str, val: &mut BitVec<u8, Lsb0>) -> Result<()> {
b'+' => 62,
b'/' => 63,
_ => {
fail!(Error::InvalidBase64(byte as char));
return Err(Error::InvalidBase64(byte as char));
}
};

Expand Down Expand Up @@ -190,11 +190,11 @@ pub fn decode_regular(rsm: RawSourceMap) -> Result<SourceMap> {

if nums.len() > 1 {
if nums.len() != 4 && nums.len() != 5 {
fail!(Error::BadSegmentSize(nums.len() as u32));
return Err(Error::BadSegmentSize(nums.len() as u32));
}
src_id = (i64::from(src_id) + nums[1]) as u32;
if src_id >= sources.len() as u32 {
fail!(Error::BadSourceReference(src_id));
return Err(Error::BadSourceReference(src_id));
}

src = src_id;
Expand All @@ -204,7 +204,7 @@ pub fn decode_regular(rsm: RawSourceMap) -> Result<SourceMap> {
if nums.len() > 4 {
name_id = (i64::from(name_id) + nums[4]) as u32;
if name_id >= names.len() as u32 {
fail!(Error::BadNameReference(name_id));
return Err(Error::BadNameReference(name_id));
}
name = name_id;
}
Expand Down Expand Up @@ -330,7 +330,7 @@ pub fn decode_slice(slice: &[u8]) -> Result<DecodedMap> {
/// Loads a sourcemap from a data URL
pub fn decode_data_url(url: &str) -> Result<DecodedMap> {
if !url.starts_with(DATA_PREAMBLE) {
fail!(Error::InvalidDataUrl);
return Err(Error::InvalidDataUrl);
}
let data_b64 = &url[DATA_PREAMBLE.len()..];
let data = data_encoding::BASE64
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
//!
//! * `ram_bundle`: turns on RAM bundle support
//!
#[warn(missing_docs)]
mod macros;

pub use crate::builder::SourceMapBuilder;
pub use crate::decoder::{decode, decode_data_url, decode_slice};
pub use crate::detector::{
Expand Down
7 changes: 0 additions & 7 deletions src/macros.rs

This file was deleted.