mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Remove a useless allocation when attaching files
This commit is contained in:
parent
16e431bc7b
commit
ef49094d28
1 changed files with 2 additions and 2 deletions
|
@ -123,8 +123,8 @@ impl InputFile {
|
||||||
///
|
///
|
||||||
/// This is used to coordinate with `attach://`.
|
/// This is used to coordinate with `attach://`.
|
||||||
pub(crate) fn id(&self) -> &str {
|
pub(crate) fn id(&self) -> &str {
|
||||||
// FIXME: remove extra alloc
|
let random = || Arc::from(&*uuid::Uuid::new_v4().as_simple().encode_lower(&mut [0; 32]));
|
||||||
self.id.get_or_init(|| uuid::Uuid::new_v4().to_string().into())
|
self.id.get_or_init(random)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if this file needs an attachment i.e. it's not a file_id
|
/// Returns `true` if this file needs an attachment i.e. it's not a file_id
|
||||||
|
|
Loading…
Reference in a new issue