Compare commits

...

4 Commits

Author SHA1 Message Date
Jerry Wu
83cf1cad62 Update 11_locks.md (#94)
Suggest removing an extra semicolon.
2024-06-20 10:21:53 +02:00
Ernie Hershey
d8d7e73f1c fix syntax with comma (#89)
Example doesn't compile with a comma here
2024-06-20 10:21:33 +02:00
Onè
468de3c0ac Change test to require impl (#87)
impl std::ops::Add<&SaturatingU16> for SaturatingU16
2024-06-20 10:21:14 +02:00
tomgrbz
c86360f3c4 Remove array/slice syntax from argument &mut str in TODO comment for lowercase func (#99)
Co-authored-by: thomasgrbic <grbic.t@northeastern.edu>
2024-06-20 10:18:55 +02:00
4 changed files with 6 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ impl Ticket {
match &self.status {
Status::InProgress { assigned_to } => assigned_to,
Status::Done | Status::ToDo => {
panic!("Only `In-Progress` tickets can be assigned to someone"),
panic!("Only `In-Progress` tickets can be assigned to someone")
}
}
}

View File

@@ -99,7 +99,7 @@ fn main() {
let guard = lock.lock().unwrap();
spawn(move || {
receiver.recv().unwrap();;
receiver.recv().unwrap();
});
// 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
11 | | receiver.recv().unwrap();;
11 | | receiver.recv().unwrap();
12 | | });
| |_^ `MutexGuard<'_, i32>` cannot be sent between threads safely
|

View File

@@ -6,11 +6,12 @@ fn test_saturating_u16() {
let b: SaturatingU16 = 5u8.into();
let c: SaturatingU16 = u16::MAX.into();
let d: SaturatingU16 = (&1u16).into();
let e = &c;
assert_eq!(a + b, SaturatingU16::from(15u16));
assert_eq!(a + c, SaturatingU16::from(u16::MAX));
assert_eq!(a + d, SaturatingU16::from(11u16));
assert_eq!(a + a, 20u16);
assert_eq!(a + 5u16, 15u16);
assert_eq!(a + &u16::MAX, SaturatingU16::from(u16::MAX));
assert_eq!(a + e, SaturatingU16::from(u16::MAX));
}

View File

@@ -1,6 +1,6 @@
// TODO: Define a function named `lowercase` that converts all characters in a string to lowercase,
// 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)]
mod tests {