huskies: merge 927
This commit is contained in:
@@ -37,6 +37,7 @@ pub fn mentions_bot(body: &str, formatted_body: Option<&str>, bot_user_id: &Owne
|
||||
}
|
||||
|
||||
/// Returns `true` if `haystack` contains `needle` at a word boundary.
|
||||
#[allow(clippy::string_slice)] // all indices from find() or abs+needle.len() → always char boundaries
|
||||
pub(super) fn contains_word(haystack: &str, needle: &str) -> bool {
|
||||
let mut start = 0;
|
||||
while let Some(rel) = haystack[start..].find(needle) {
|
||||
@@ -87,6 +88,7 @@ pub(super) async fn is_reply_to_bot(
|
||||
///
|
||||
/// Used in ambient mode to suppress responses when a message is clearly
|
||||
/// directed at a different participant (e.g. another bot in the same room).
|
||||
#[allow(clippy::string_slice)] // word_end and colon_pos from find() → always char boundaries
|
||||
pub fn is_addressed_to_other(body: &str, bot_user_id: &OwnedUserId, bot_name: &str) -> bool {
|
||||
let trimmed = body.trim_start();
|
||||
let lower = trimmed.to_lowercase();
|
||||
|
||||
@@ -101,6 +101,7 @@ fn parse_duration(s: &str) -> Option<u64> {
|
||||
///
|
||||
/// Returns a short string like `"load average: 1.23, 0.98, 0.75"` on success,
|
||||
/// or `"load: unknown"` on failure.
|
||||
#[allow(clippy::string_slice)] // idx comes from output.find("load average") → always a char boundary
|
||||
fn get_load_average() -> String {
|
||||
let output = std::process::Command::new("uptime")
|
||||
.output()
|
||||
|
||||
Reference in New Issue
Block a user