Compare commits
4 Commits
056611ac1c
...
83cf1cad62
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83cf1cad62 | ||
|
|
d8d7e73f1c | ||
|
|
468de3c0ac | ||
|
|
c86360f3c4 |
@@ -8,7 +8,7 @@ impl Ticket {
|
|||||||
match &self.status {
|
match &self.status {
|
||||||
Status::InProgress { assigned_to } => assigned_to,
|
Status::InProgress { assigned_to } => assigned_to,
|
||||||
Status::Done | Status::ToDo => {
|
Status::Done | Status::ToDo => {
|
||||||
panic!("Only `In-Progress` tickets can be assigned to someone"),
|
panic!("Only `In-Progress` tickets can be assigned to someone")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ fn main() {
|
|||||||
let guard = lock.lock().unwrap();
|
let guard = lock.lock().unwrap();
|
||||||
|
|
||||||
spawn(move || {
|
spawn(move || {
|
||||||
receiver.recv().unwrap();;
|
receiver.recv().unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Try to send the guard over the channel
|
// Try to send the guard over the channel
|
||||||
@@ -118,7 +118,7 @@ error[E0277]: `MutexGuard<'_, i32>` cannot be sent between threads safely
|
|||||||
| _-----_^
|
| _-----_^
|
||||||
| | |
|
| | |
|
||||||
| | required by a bound introduced by this call
|
| | required by a bound introduced by this call
|
||||||
11 | | receiver.recv().unwrap();;
|
11 | | receiver.recv().unwrap();
|
||||||
12 | | });
|
12 | | });
|
||||||
| |_^ `MutexGuard<'_, i32>` cannot be sent between threads safely
|
| |_^ `MutexGuard<'_, i32>` cannot be sent between threads safely
|
||||||
|
|
|
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ fn test_saturating_u16() {
|
|||||||
let b: SaturatingU16 = 5u8.into();
|
let b: SaturatingU16 = 5u8.into();
|
||||||
let c: SaturatingU16 = u16::MAX.into();
|
let c: SaturatingU16 = u16::MAX.into();
|
||||||
let d: SaturatingU16 = (&1u16).into();
|
let d: SaturatingU16 = (&1u16).into();
|
||||||
|
let e = &c;
|
||||||
|
|
||||||
assert_eq!(a + b, SaturatingU16::from(15u16));
|
assert_eq!(a + b, SaturatingU16::from(15u16));
|
||||||
assert_eq!(a + c, SaturatingU16::from(u16::MAX));
|
assert_eq!(a + c, SaturatingU16::from(u16::MAX));
|
||||||
assert_eq!(a + d, SaturatingU16::from(11u16));
|
assert_eq!(a + d, SaturatingU16::from(11u16));
|
||||||
assert_eq!(a + a, 20u16);
|
assert_eq!(a + a, 20u16);
|
||||||
assert_eq!(a + 5u16, 15u16);
|
assert_eq!(a + 5u16, 15u16);
|
||||||
assert_eq!(a + &u16::MAX, SaturatingU16::from(u16::MAX));
|
assert_eq!(a + e, SaturatingU16::from(u16::MAX));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// TODO: Define a function named `lowercase` that converts all characters in a string to lowercase,
|
// TODO: Define a function named `lowercase` that converts all characters in a string to lowercase,
|
||||||
// modifying the input in place.
|
// modifying the input in place.
|
||||||
// Does it need to take a `&mut String`? Does a `&mut [str]` work? Why or why not?
|
// Does it need to take a `&mut String`? Does a `&mut str` work? Why or why not?
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|||||||
Reference in New Issue
Block a user