Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit29a24c7

Browse files
committed
Fix warnings
- use non-deprecated `Duration::try_days` method- remove redundant top-level `rand` import
1 parent9a3e9c0 commit29a24c7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

‎postgres-protocol/src/authentication/sasl.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use base64::display::Base64Display;
44
use base64::engine::general_purpose::STANDARD;
55
use base64::Engine;
66
use hmac::{Hmac,Mac};
7-
use rand::{self,Rng};
7+
use rand::Rng;
88
use sha2::digest::FixedOutput;
99
use sha2::{Digest,Sha256};
1010
use std::fmt::Write;

‎postgres-types/src/chrono_04.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ impl ToSql for DateTime<FixedOffset> {
111111
impl<'a>FromSql<'a>forNaiveDate{
112112
fnfrom_sql(_:&Type,raw:&[u8]) ->Result<NaiveDate,Box<dynError +Sync +Send>>{
113113
let jd = types::date_from_sql(raw)?;
114+
let jd =Duration::try_days(i64::from(jd))
115+
.ok_or_else(||"value too large to decode")?;
114116
base()
115117
.date()
116-
.checked_add_signed(Duration::days(i64::from(jd)))
118+
.checked_add_signed(jd)
117119
.ok_or_else(||"value too large to decode".into())
118120
}
119121

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp