Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
epel9
Igor Gnatenko 6 years ago
parent 7203933f21
commit 280b5e097c
No known key found for this signature in database
GPG Key ID: 695714BD1BBC5F4C

@ -0,0 +1,115 @@
From c25f0f9db85c3de547053db8a36e208930c836e0 Mon Sep 17 00:00:00 2001
From: Andrew Gallant <jamslam@gmail.com>
Date: Mon, 4 Mar 2019 16:20:42 -0500
Subject: [PATCH] doc: fix overflowing literals in doc tests
These were likely a result of copy & pasting example code. There is
actually an overflowing literal lint that would normally catch this, but
doc tests do not need to output lint warnings by default.
Rust 2018 made overflowing literals deny-by-default, and Rust 2015 just
recently did the same---even though it's a breaking change. That in turn
caused the doc tests to fail, and thus, we finally noticed it.
Fixes #144
---
src/lib.rs | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/lib.rs b/src/lib.rs
index 497e914..0274d74 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -200,8 +200,8 @@ mod private {
/// use byteorder::{ByteOrder, BigEndian};
///
/// let mut buf = [0; 2];
-/// BigEndian::write_i16(&mut buf, -50_000);
-/// assert_eq!(-50_000, BigEndian::read_i16(&buf));
+/// BigEndian::write_i16(&mut buf, -5_000);
+/// assert_eq!(-5_000, BigEndian::read_i16(&buf));
/// ```
///
/// [`BigEndian`]: enum.BigEndian.html
@@ -372,8 +372,8 @@ pub trait ByteOrder
/// use byteorder::{ByteOrder, LittleEndian};
///
/// let mut buf = [0; 2];
- /// LittleEndian::write_u16(&mut buf, 1_000_000);
- /// assert_eq!(1_000_000, LittleEndian::read_u16(&buf));
+ /// LittleEndian::write_u16(&mut buf, 1_000);
+ /// assert_eq!(1_000, LittleEndian::read_u16(&buf));
/// ```
fn write_u16(buf: &mut [u8], n: u16);
@@ -1079,7 +1079,7 @@ pub trait ByteOrder
/// use byteorder::{ByteOrder, LittleEndian};
///
/// let mut bytes = [0; 8];
- /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+ /// let numbers_given = [1, 2, 0x0f, 0xee];
/// LittleEndian::write_i16_into(&numbers_given, &mut bytes);
///
/// let mut numbers_got = [0; 4];
@@ -1258,7 +1258,7 @@ pub trait ByteOrder
/// use byteorder::{ByteOrder, LittleEndian};
///
/// let mut bytes = [0; 32];
- /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91];
+ /// let numbers_given = [1.0, 2.0, 31.312e211, -11.32e91];
/// LittleEndian::write_f64_into(&numbers_given, &mut bytes);
///
/// let mut numbers_got = [0.0; 4];
@@ -1292,7 +1292,7 @@ pub trait ByteOrder
/// use byteorder::{ByteOrder, LittleEndian};
///
/// let mut bytes = [0; 32];
- /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91];
+ /// let numbers_given = [1.0, 2.0, 31.312e211, -11.32e91];
/// LittleEndian::write_f64_into(&numbers_given, &mut bytes);
///
/// let mut numbers_got = [0.0; 4];
@@ -1412,7 +1412,7 @@ pub trait ByteOrder
/// use byteorder::{ByteOrder, LittleEndian};
///
/// let mut bytes = [0; 8];
- /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+ /// let numbers_given = [1, 2, 0x0f, 0xee];
/// LittleEndian::write_i16_into(&numbers_given, &mut bytes);
///
/// let mut numbers_got = [0; 4];
@@ -1557,7 +1557,7 @@ pub trait ByteOrder
/// use byteorder::{ByteOrder, LittleEndian};
///
/// let mut bytes = [0; 32];
- /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91];
+ /// let numbers_given = [1.0, 2.0, 31.312e211, -11.32e91];
/// LittleEndian::write_f64_into(&numbers_given, &mut bytes);
///
/// let mut numbers_got = [0.0; 4];
@@ -1663,9 +1663,9 @@ pub trait ByteOrder
/// ```rust
/// use byteorder::{ByteOrder, BigEndian};
///
- /// let mut numbers = [5, 65000];
+ /// let mut numbers = [5, 6500];
/// BigEndian::from_slice_i16(&mut numbers);
- /// assert_eq!(numbers, [5i16.to_be(), 65000i16.to_be()]);
+ /// assert_eq!(numbers, [5i16.to_be(), 6500i16.to_be()]);
/// ```
#[inline]
fn from_slice_i16(src: &mut [i16]) {
@@ -1845,8 +1845,8 @@ pub type LE = LittleEndian;
/// use byteorder::{ByteOrder, NetworkEndian, BigEndian};
///
/// let mut buf = [0; 2];
-/// BigEndian::write_i16(&mut buf, -50_000);
-/// assert_eq!(-50_000, NetworkEndian::read_i16(&buf));
+/// BigEndian::write_i16(&mut buf, -5_000);
+/// assert_eq!(-5_000, NetworkEndian::read_i16(&buf));
/// ```
///
/// [`BigEndian`]: enum.BigEndian.html
--
2.22.0.rc3

@ -13,6 +13,8 @@ Summary: Library for reading/writing numbers in big-endian and little-end
License: Unlicense or MIT
URL: https://crates.io/crates/byteorder
Source: %{crates_source}
# https://github.com/BurntSushi/byteorder/commit/c25f0f9db85c3de547053db8a36e208930c836e0
Patch0001: 0001-doc-fix-overflowing-literals-in-doc-tests.patch
ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build}

Loading…
Cancel
Save