Skip to content

Commit 39ad5ff

Browse files
committed
Fix for opt in Copy
1 parent 05c4185 commit 39ad5ff

4 files changed

Lines changed: 19 additions & 13 deletions

File tree

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ pub trait NoticeHandler: Send {
202202
/// A notice handler which logs at the `info` level.
203203
///
204204
/// This is the default handler used by a `Connection`.
205+
#[deriving(Copy)]
205206
pub struct DefaultNoticeHandler;
206207

207208
impl NoticeHandler for DefaultNoticeHandler {
@@ -319,6 +320,7 @@ impl<'conn> Notifications<'conn> {
319320
}
320321

321322
/// Contains information necessary to cancel queries for a session
323+
#[deriving(Copy)]
322324
pub struct CancelData {
323325
/// The process ID of the session
324326
pub process_id: u32,

src/types/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use self::ArrayParent::{SliceParent, MutSliceParent, BaseParent};
77
use self::MutArrayParent::{MutSliceMutParent, MutBaseParent};
88

99
/// Information about a dimension of an array
10-
#[deriving(PartialEq, Eq, Clone)]
10+
#[deriving(PartialEq, Eq, Clone, Copy)]
1111
pub struct DimensionInfo {
1212
/// The size of the dimension
1313
pub len: uint,

src/types/range.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bounded_normalizable!(i32)
133133
bounded_normalizable!(i64)
134134

135135
/// The possible sides of a bound
136-
#[deriving(PartialEq, Eq)]
136+
#[deriving(PartialEq, Eq, Copy)]
137137
pub enum BoundSide {
138138
/// An upper bound
139139
Upper,
@@ -150,9 +150,11 @@ pub trait BoundSided {
150150
}
151151

152152
/// A tag type representing an upper bound
153+
#[allow(missing_copy_implementations)]
153154
pub enum UpperBound {}
154155

155156
/// A tag type representing a lower bound
157+
#[allow(missing_copy_implementations)]
156158
pub enum LowerBound {}
157159

158160
impl BoundSided for UpperBound {
@@ -168,7 +170,7 @@ impl BoundSided for LowerBound {
168170
}
169171

170172
/// The type of a range bound
171-
#[deriving(PartialEq, Eq, Clone)]
173+
#[deriving(PartialEq, Eq, Clone, Copy)]
172174
pub enum BoundType {
173175
/// The bound includes its value
174176
Inclusive,
@@ -186,6 +188,8 @@ pub struct RangeBound<S: BoundSided, T> {
186188
pub type_: BoundType
187189
}
188190

191+
impl<S, T> Copy for RangeBound<S, T> where S: BoundSided, T: Copy {}
192+
189193
impl<S, T> Clone for RangeBound<S, T> where S: BoundSided, T: Clone {
190194
fn clone(&self) -> RangeBound<S, T> {
191195
RangeBound {
@@ -280,24 +284,24 @@ impl<'a, S, T> PartialEq for OptBound<'a, S, T> where S: BoundSided, T: PartialE
280284

281285
impl<'a, S, T> PartialOrd for OptBound<'a, S, T> where S: BoundSided, T: PartialOrd {
282286
fn partial_cmp(&self, other: &OptBound<'a, S, T>) -> Option<Ordering> {
283-
match (*self, *other, BoundSided::side(None::<S>)) {
284-
(OptBound(None), OptBound(None), _) => Some(Equal),
285-
(OptBound(None), _, Lower)
286-
| (_, OptBound(None), Upper) => Some(Less),
287-
(OptBound(None), _, Upper)
288-
| (_, OptBound(None), Lower) => Some(Greater),
289-
(OptBound(Some(a)), OptBound(Some(b)), _) => a.partial_cmp(b)
287+
match (self, other, BoundSided::side(None::<S>)) {
288+
(&OptBound(None), &OptBound(None), _) => Some(Equal),
289+
(&OptBound(None), _, Lower)
290+
| (_, &OptBound(None), Upper) => Some(Less),
291+
(&OptBound(None), _, Upper)
292+
| (_, &OptBound(None), Lower) => Some(Greater),
293+
(&OptBound(Some(a)), &OptBound(Some(b)), _) => a.partial_cmp(b)
290294
}
291295
}
292296
}
293297

294298
/// Represents a range of values.
295-
#[deriving(PartialEq, Eq, Clone)]
299+
#[deriving(PartialEq, Eq, Clone, Copy)]
296300
pub struct Range<T> {
297301
inner: InnerRange<T>,
298302
}
299303

300-
#[deriving(PartialEq, Eq, Clone)]
304+
#[deriving(PartialEq, Eq, Clone, Copy)]
301305
enum InnerRange<T> {
302306
Empty,
303307
Normal(Option<RangeBound<LowerBound, T>>,

tests/types/uuid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ fn test_uuidarray_params() {
1717
let (v1, s1) = make_check("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
1818
let (v2, s2) = make_check("00000000-0000-0000-0000-000000000000");
1919
let (v3, s3) = make_check("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
20-
test_array_params!("UUID", v1, s1, v2, s2, v3, s3);
20+
test_array_params!("UUID", v1.clone(), s1, v2.clone(), s2, v3.clone(), s3);
2121
}
2222

0 commit comments

Comments
 (0)