Skip to content

Commit e2abcc6

Browse files
committed
Rename SiteCtxt local variables from data to ctxt
1 parent 27d5e15 commit e2abcc6

File tree

6 files changed

+199
-202
lines changed

6 files changed

+199
-202
lines changed

site/src/comparison.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! comparison endpoints
44
55
use crate::api;
6-
use crate::db::{self, ArtifactId, Cache, Crate, Profile};
6+
use crate::db::{ArtifactId, Cache, Crate, Profile};
77
use crate::load::SiteCtxt;
88
use crate::selector::{self, Tag};
99

@@ -18,7 +18,7 @@ type BoxedError = Box<dyn Error + Send + Sync>;
1818

1919
pub async fn handle_triage(
2020
body: api::triage::Request,
21-
data: &SiteCtxt,
21+
ctxt: &SiteCtxt,
2222
) -> Result<api::triage::Response, BoxedError> {
2323
let start = body.start;
2424
let end = body.end;
@@ -28,7 +28,7 @@ pub async fn handle_triage(
2828
start.clone(),
2929
start.clone(),
3030
"instructions:u".to_owned(),
31-
data,
31+
ctxt,
3232
&master_commits,
3333
)
3434
.await?
@@ -43,7 +43,7 @@ pub async fn handle_triage(
4343
before,
4444
after.clone(),
4545
"instructions:u".to_owned(),
46-
data,
46+
ctxt,
4747
&master_commits,
4848
)
4949
.await?
@@ -84,16 +84,16 @@ pub async fn handle_triage(
8484

8585
pub async fn handle_compare(
8686
body: api::comparison::Request,
87-
data: &SiteCtxt,
87+
ctxt: &SiteCtxt,
8888
) -> Result<api::comparison::Response, BoxedError> {
8989
let master_commits = collector::master_commits().await?;
9090
let end = body.end;
9191
let comparison =
92-
compare_given_commits(body.start, end.clone(), body.stat, data, &master_commits)
92+
compare_given_commits(body.start, end.clone(), body.stat, ctxt, &master_commits)
9393
.await?
9494
.ok_or_else(|| format!("could not find end commit for bound {:?}", end))?;
9595

96-
let conn = data.conn().await;
96+
let conn = ctxt.conn().await;
9797
let prev = comparison.prev(&master_commits);
9898
let next = comparison.next(&master_commits);
9999
let is_contiguous = comparison.is_contiguous(&*conn, &master_commits).await;
@@ -241,24 +241,24 @@ pub async fn compare(
241241
start: Bound,
242242
end: Bound,
243243
stat: String,
244-
data: &SiteCtxt,
244+
ctxt: &SiteCtxt,
245245
) -> Result<Option<Comparison>, BoxedError> {
246246
let master_commits = collector::master_commits().await?;
247-
compare_given_commits(start, end, stat, data, &master_commits).await
247+
compare_given_commits(start, end, stat, ctxt, &master_commits).await
248248
}
249249

250250
/// Compare two bounds on a given stat
251251
pub async fn compare_given_commits(
252252
start: Bound,
253253
end: Bound,
254254
stat: String,
255-
data: &SiteCtxt,
255+
ctxt: &SiteCtxt,
256256
master_commits: &[collector::MasterCommit],
257257
) -> Result<Option<Comparison>, BoxedError> {
258-
let a = data
258+
let a = ctxt
259259
.data_for(true, start.clone())
260260
.ok_or(format!("could not find start commit for bound {:?}", start))?;
261-
let b = match data.data_for(false, end.clone()) {
261+
let b = match ctxt.data_for(false, end.clone()) {
262262
Some(b) => b,
263263
None => return Ok(None),
264264
};
@@ -273,9 +273,9 @@ pub async fn compare_given_commits(
273273

274274
// `responses` contains series iterators. The first element in the iterator is the data
275275
// for `a` and the second is the data for `b`
276-
let mut responses = data.query::<Option<f64>>(query, cids).await?;
276+
let mut responses = ctxt.query::<Option<f64>>(query, cids).await?;
277277

278-
let conn = data.conn().await;
278+
let conn = ctxt.conn().await;
279279

280280
Ok(Some(Comparison {
281281
a: ArtifactData::consume_one(&*conn, a.clone(), &mut responses, master_commits).await,
@@ -312,7 +312,7 @@ impl ArtifactData {
312312
master_commits: &[collector::MasterCommit],
313313
) -> Self
314314
where
315-
T: Iterator<Item = (db::ArtifactId, Option<f64>)>,
315+
T: Iterator<Item = (ArtifactId, Option<f64>)>,
316316
{
317317
let mut data = HashMap::new();
318318

0 commit comments

Comments
 (0)